Re: protected data members

[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]

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

Follow Ups:

Post a Followup




Optional Link URL:
Link Title:
Optional Image URL:

[ Follow Ups ] [ Post Followup ] [ CS2704 Web Discussion Board ] [ FAQ ]