home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware 1 2 the Maxx
/
sw_1.zip
/
sw_1
/
PROGRAM
/
CPTUTS22.ZIP
/
CLASS1.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-01-20
|
672b
|
38 lines
// Chapter 2 - Program 3
#include <iostream.h>
class animal {
public:
int weight;
int feet;
};
main()
{
animal dog1, dog2, chicken;
animal cat1;
class animal cat2;
dog1.weight = 15;
dog2.weight = 37;
chicken.weight = 3;
dog1.feet = 4;
dog2.feet = 4;
chicken.feet = 2;
cout << "The weight of dog1 is " << dog1.weight << "\n";
cout << "The weight of dog2 is " << dog2.weight << "\n";
cout << "The weight of chicken is " << chicken.weight << "\n";
}
// Result of execution
//
// The weight of dog1 is 15
// The weight of dog2 is 37
// The weight of chicken is 3