home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C++ for Dummies (3rd Edition)
/
C_FD.iso
/
CHAP27
/
CHAP27_1.CPP
next >
Wrap
C/C++ Source or Header
|
1996-09-15
|
693b
|
48 lines
// Chap27_1.cpp
class Bed
{
public:
Bed()
{
}
void sleep()
{
}
int weight;
};
class Sofa
{
public:
Sofa()
{
}
void watchTV()
{
}
int weight;
};
//SleeperSofa - is both a Bed and a Sofa
class SleeperSofa : public Bed, public Sofa
{
public:
SleeperSofa()
{
}
void foldOut()
{
}
};
int main()
{
SleeperSofa ss;
//you can watch TV on a sleeper sofa...
ss.watchTV(); //Sofa::watchTV()
//...and then you can fold it out...
ss.foldOut(); //SleeperSofa::foldOut()
//...and sleep on it (sort of)
ss.sleep(); //Bed::sleep()
return 0;
}