home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_11_11
/
pugh
/
pedcon.hpp
Wrap
C/C++ Source or Header
|
1993-09-08
|
816b
|
41 lines
class CBase
{
public:
CBase() { m_n=0;}
virtual ~CBase() { } ;
void SetN(int n) {m_n = n;}
int GetN() {return m_n;}
CBase operator-(const CBase & base) const;
const CBase & operator+=(int n);
const CBase & operator-=(int n);
const CBase & operator++(); //prefix ++ operator
CBase operator++(int); //postfix ++ operator
int operator==(const CBase& base) const;
private:
int m_n;
};
class CDerived : public CBase
{
public:
CDerived() {};
const CDerived& operator=(const CDerived& derived);
};
void main()
{
CBase b1, b2;
CDerived d1, d2;
b1.SetN(5);
b2.SetN(10);
d1.SetN(7);
d2.SetN(12);
CBase b3;
CDerived d3;
d3 = d2 - d1;
}