Click here to Skip to main content
15,887,135 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Fighting a monster Pin
Pete O'Hanlon2-Mar-23 6:28
mvePete O'Hanlon2-Mar-23 6:28 
GeneralRe: Fighting a monster Pin
Gerry Schmitz2-Mar-23 6:31
mveGerry Schmitz2-Mar-23 6:31 
GeneralRe: Fighting a monster Pin
trønderen2-Mar-23 9:00
trønderen2-Mar-23 9:00 
GeneralRe: Fighting a monster Pin
Gerry Schmitz3-Mar-23 5:54
mveGerry Schmitz3-Mar-23 5:54 
GeneralRe: Fighting a monster Pin
PIEBALDconsult2-Mar-23 6:31
mvePIEBALDconsult2-Mar-23 6:31 
GeneralRe: Fighting a monster Pin
honey the codewitch2-Mar-23 6:36
mvahoney the codewitch2-Mar-23 6:36 
GeneralRe: Fighting a monster Pin
PIEBALDconsult2-Mar-23 6:43
mvePIEBALDconsult2-Mar-23 6:43 
GeneralRe: Fighting a monster Pin
honey the codewitch2-Mar-23 6:55
mvahoney the codewitch2-Mar-23 6:55 
No, it would be nice to be able to declare a class twice in two different files and have it compiled into the same binary.

C++ does not let you do that, at least not to my knowledge, unless they added it after C++17.

For example, I have a draw class that handles all the drawing operations in my graphics library.

It would be nice to segregate the different drawing primitives into different files, but the only way to do that is to delegate and forward or to use multiple C++ implementation files for a single class, but you still wind up with all the method definitions for all the drawing primitives in the same header.

You can hack around it using the preprocessor, by #includeing class fragments, but that's techy.

Edit: You can use inheritance to approximate it, but that still runs you into visibility issues.
To err is human. Fortune favors the monsters.

GeneralRe: Fighting a monster Pin
PIEBALDconsult2-Mar-23 7:57
mvePIEBALDconsult2-Mar-23 7:57 
GeneralRe: Fighting a monster Pin
Mircea Neacsu2-Mar-23 7:32
Mircea Neacsu2-Mar-23 7:32 
GeneralRe: Fighting a monster Pin
PIEBALDconsult2-Mar-23 8:00
mvePIEBALDconsult2-Mar-23 8:00 
GeneralRe: Fighting a monster Pin
Mircea Neacsu2-Mar-23 8:02
Mircea Neacsu2-Mar-23 8:02 
GeneralRe: Fighting a monster Pin
PIEBALDconsult2-Mar-23 8:11
mvePIEBALDconsult2-Mar-23 8:11 
GeneralRe: Fighting a monster Pin
Daniel Pfeffer2-Mar-23 9:23
professionalDaniel Pfeffer2-Mar-23 9:23 
GeneralRe: Fighting a monster Pin
honey the codewitch2-Mar-23 11:19
mvahoney the codewitch2-Mar-23 11:19 
GeneralRe: Fighting a monster Pin
OriginalGriff2-Mar-23 6:39
mveOriginalGriff2-Mar-23 6:39 
GeneralRe: Fighting a monster Pin
DerekT-P2-Mar-23 6:57
professionalDerekT-P2-Mar-23 6:57 
GeneralRe: Fighting a monster Pin
trønderen2-Mar-23 8:39
trønderen2-Mar-23 8:39 
GeneralRe: Fighting a monster Pin
DerekT-P2-Mar-23 22:31
professionalDerekT-P2-Mar-23 22:31 
GeneralRe: Fighting a monster Pin
trønderen3-Mar-23 5:57
trønderen3-Mar-23 5:57 
GeneralRe: Fighting a monster Pin
Mircea Neacsu3-Mar-23 1:27
Mircea Neacsu3-Mar-23 1:27 
GeneralRe: Fighting a monster Pin
englebart3-Mar-23 3:33
professionalenglebart3-Mar-23 3:33 
GeneralRe: Fighting a monster Pin
trønderen3-Mar-23 6:18
trønderen3-Mar-23 6:18 
GeneralRe: Fighting a monster Pin
Richard MacCutchan3-Mar-23 3:47
mveRichard MacCutchan3-Mar-23 3:47 
GeneralRe: Fighting a monster Pin
Rick York2-Mar-23 7:09
mveRick York2-Mar-23 7:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.