| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Re: #defines |
G'Day Steven,
-=> Quoting Steven Pasztor to David Nugent <=-
SP> How do I do that in C? These darn BC++ books are no help, and we
SP> don't do it in uni till sometime next year... And even then it'll
SP> probably be mid-semester by the time we get around to
SP> anything that complicated... :-)
Bit rusty on this, but here goes ...
class baseclass
{
private :
// available to base only and friends
protected:
// available to base,derived and friends
public :
// available to every dog and its flea.
};
class derived : public baseclass
{
};
If you don't specify protected or public in a class, it's members are
assumed private, so your derived class won't have any access to them.
Same way if you don't define the baseclass as public in the declaration of
the derived class (eg class derived : baseclass) it will AFAIK be useless
code, because baseclass will again be assumed private.
so now in main()..
baseclass base;
derived derv;
derv can now have access to members and data that are NOT private in base.
L8r Frank (fadam{at}ozemail.com.au).
___ Blue Wave/DOS v2.21
---
* Origin: Melbourne PC User Group BBS (3:632/309)SEEN-BY: 633/267 270 @PATH: 632/309 107 360 50/99 635/728 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
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™.