TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: MIKE WALKER
from: BLAKE GAFFNEY
date: 1998-04-09 21:14:00
subject: Private / Protected

On the 05 Apr 98, Mike Walker performed the most audacious feat of 
simultaneous gibbering and moaning. It was generally directed at All
 MW> Something that I am not quite clear on is the difference between
 MW> private and protected specifiers within a class. Can someone explain
 MW> the difference between these?
protected: means the data can only be modified by a derived class.
 MW> Also when would each be used?
Some would say protected: should be used when there are virtual functions 
that may have to deal with particular data.
For example, if you designed an abstract base class for a linked-list, you'd 
want the head/tail pointers hidden from the user, but you'd also want them 
accessible to the virtual functions in a derived class that will be providing 
the implementation.
That's not a wholly-realistic example, an abstract base class should not 
force a particular implementation by providing data for it, but you get the 
idea.
Looks like *another* happy ending!
 offworld@bleach.demon.co.uk   >##<
... MicroSoft tech support: "Remove all useful utilities from your system."
 >> Tag-o-Miga 1.1a - Quoted 31% - 772 tags in Taglines.txt <<
--- Spot 1.3a #1508
---------------
* Origin: None (2:442/107.7)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.