Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Public vs Private (vs Protected)

Name: Anonymous 2011-05-19 20:39

Alright /prog/, do you prefer to default your class' members to public or private and why?

class dude : person {
public:
  int var1, var2;
};


or

class dude : person {
  int var1, var2;
};

Name: sb 2011-05-19 22:51

Always use private and use getters and setters unless it is a private class. Trust me, things will change in the future and you will want to be able to change your implementation without having to change all the code that uses your class.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List