Skip to main content
6 events
when toggle format what by license comment
Oct 8, 2012 at 23:33 comment added supercat There is a huge difference between protected and public members. If BaseType exposes a public member, that implies that all derived types must have that same member work the same way, since a DerivedType instance may be passed to code which receives a BaseType reference and expects to use that member. By contrast, if BaseType exposes a protected member, then DerivedType may expect to access that member in base, but base can't be anything other than a BaseType.
Sep 1, 2012 at 17:02 history edited Robert Harvey CC BY-SA 3.0
added 2 characters in body
Aug 30, 2012 at 4:42 comment added Martin Beckett Just to offer an opposing point of view - I make all my variables protected in a base class. If they are only to be accessed through a public interface then it shouldn't be a derived class, it should just contain a baseclass object. But I also avoid hierarchies more than 2 classes deep
Aug 28, 2012 at 23:01 history edited Robert Harvey CC BY-SA 3.0
added 29 characters in body
Aug 28, 2012 at 22:32 history edited Robert Harvey CC BY-SA 3.0
added 1 characters in body
Aug 28, 2012 at 16:05 history answered Robert Harvey CC BY-SA 3.0