Click here to Skip to main content
15,900,108 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: Do you embed classes within classes? Pin
obermd29-Apr-24 3:19
obermd29-Apr-24 3:19 
GeneralRe: Do you embed classes within classes? Pin
charlieg29-Apr-24 3:59
charlieg29-Apr-24 3:59 
GeneralRe: Do you embed classes within classes? Pin
Salvatore Terress29-Apr-24 15:00
Salvatore Terress29-Apr-24 15:00 
GeneralRe: Do you embed classes within classes? Pin
Matt Bond30-Apr-24 7:38
Matt Bond30-Apr-24 7:38 
GeneralRe: Do you embed classes within classes? Pin
englebart30-Apr-24 15:26
professionalenglebart30-Apr-24 15:26 
GeneralRe: Do you embed classes within classes? Pin
maze329-Apr-24 23:41
professionalmaze329-Apr-24 23:41 
GeneralRe: Do you embed classes within classes? Pin
BernardIE531730-Apr-24 0:28
BernardIE531730-Apr-24 0:28 
GeneralRe: Do you embed classes within classes? Pin
Gary Wheeler30-Apr-24 1:13
Gary Wheeler30-Apr-24 1:13 
charlieg wrote:
do you embed classes within classes?
Yes, if appropriate. The maxim "the right tool for the job" applies.

I manage visibility with private/protected as necessary if the embedded class is only used internally by the surrounding class. An example would be elements in a data structure used within the surrounding class.

If an embedded class is public, then it is embedded because it has relevance only in relation to the surrounding class. The example here would be the embedded class contains properties and state of interest to users of the surrounding class and it's either cumbersome or infeasible to have the surrounding class supply those values itself.
Software Zen: delete this;

GeneralRe: Do you embed classes within classes? Pin
charlieg30-Apr-24 16:45
charlieg30-Apr-24 16:45 
GeneralRe: Do you embed classes within classes? Pin
steve.tabler30-Apr-24 3:20
steve.tabler30-Apr-24 3:20 
GeneralRe: Do you embed classes within classes? Pin
charlieg30-Apr-24 16:49
charlieg30-Apr-24 16:49 
GeneralRe: Do you embed classes within classes? Pin
steve.tabler30-Apr-24 18:35
steve.tabler30-Apr-24 18:35 
GeneralRe: Do you embed classes within classes? Pin
charlieg2-May-24 11:05
charlieg2-May-24 11:05 
GeneralRe: Do you embed classes within classes? Pin
steve.tabler5-May-24 16:13
steve.tabler5-May-24 16:13 
GeneralRe: Do you embed classes within classes? Pin
charlieg6-May-24 2:35
charlieg6-May-24 2:35 
GeneralRe: Do you embed classes within classes? Pin
PIEBALDconsult30-Apr-24 3:55
mvePIEBALDconsult30-Apr-24 3:55 
GeneralRe: Do you embed classes within classes? Pin
charlieg30-Apr-24 16:46
charlieg30-Apr-24 16:46 
GeneralRule and Exception Pin
Amarnath S29-Apr-24 0:53
professionalAmarnath S29-Apr-24 0:53 
GeneralRe: Rule and Exception Pin
Mike Hankey29-Apr-24 1:12
mveMike Hankey29-Apr-24 1:12 
GeneralRe: Rule and Exception Pin
obermd29-Apr-24 3:26
obermd29-Apr-24 3:26 
GeneralRe: Rule and Exception Pin
englebart4-May-24 16:41
professionalenglebart4-May-24 16:41 
GeneralRe: Rule and Exception Pin
PIEBALDconsult29-Apr-24 3:30
mvePIEBALDconsult29-Apr-24 3:30 
GeneralRe: Rule and Exception Pin
k505429-Apr-24 4:21
mvek505429-Apr-24 4:21 
GeneralRe: Rule and Exception Pin
Amarnath S29-Apr-24 17:47
professionalAmarnath S29-Apr-24 17:47 
GeneralRe: Rule and Exception Pin
trønderen29-Apr-24 5:28
trønderen29-Apr-24 5:28 

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.


Straw Poll

Were you affected by the geomagnetic storms this past weekend?
Communication disruptions, electrified pipes, random unexplained blue-screens in Windows - the list of effects is terrifying.
  Results   481 votes