Posted by William D McQuain on November 29, 2001 at 15:31:37:
In Reply to: Re: protected data members posted by Chris on November 29, 2001 at 13:52:15:
: Why wouldn't you be allowed to? That's the purpose of protected data.
Some designers object to using protected data because it exposes the implementation of the base class. They argue that data should be private and if necessary you should add protected mutators and/or accessors. That does give you the chance to force derived objects to go through the same error checking and parameter validation you might force on client code.
I've got some sympathy for that view... but as far as the project goes, there's no objection to using protected data.
: : In our base class, Can we use protected data members instead of private so we can access the members directly in our derived classes?
: : Thanks
: : Chris
Post a Followup