include vcl include iostream class Cat public cat itsAge itsWeight Cat

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <vcl.h>
#include <iostream.h>
class Cat
{
public:
cat() { itsAge = 1; itsWeight = 5; }
~Cat() {}
int GetAge() const { return itsAge; }
int GetWeight() const { return itsWeight; }
void SetAge(int age) {itsAge = age; }
private:
int itsAge;
int itsWeight;
};
int main()
{
Cat Litter[5];
int i;
for (i = 0; i < 5; i++)
Litter[i].SetAge(2*i+1);
for (i=0;i<5;i++)
cout << "Cat # " << i+1 << ": " << Litter[i].GetAge() << endl;
cin.get();
}