#include
<
iostream
>
class SimpleCat
... {
public:
SimpleCat();
~SimpleCat();
int GetAge() const ...{return *itsAge;}
void SetAge(int age) ...{*itsAge=age;}
int GetWeight() const ...{return *itsWeight;}
void SetWeight(int weight) ...{*itsWeight =weight;}
private:
int *itsAge, *itsWeight;
} ;
SimpleCat::SimpleCat()
... {
itsAge=new int(2);
itsWeight=new int(5);
}
SimpleCat:: ~ SimpleCat()
... {
delete itsAge;
delete itsWeight;
}
int main()
... {
using namespace std;
SimpleCat *Frisky =new SimpleCat;
cout << "Frisky is "<< Frisky->GetAge() << "years old"<< endl;
Frisky->SetAge(5);
cout << "Frisky is "<< Frisky->GetAge() << "years old"<< endl;
cout << "Frisky is "<< Frisky->GetWeight() << "years old"<< endl;
Frisky->SetWeight(10);
cout << "Frisky is "<< Frisky->GetWeight() << "years old"<< endl;
delete Frisky;
return 0;
}
class SimpleCat
... {
public:
SimpleCat();
~SimpleCat();
int GetAge() const ...{return *itsAge;}
void SetAge(int age) ...{*itsAge=age;}
int GetWeight() const ...{return *itsWeight;}
void SetWeight(int weight) ...{*itsWeight =weight;}
private:
int *itsAge, *itsWeight;
} ;
SimpleCat::SimpleCat()
... {
itsAge=new int(2);
itsWeight=new int(5);
}
SimpleCat:: ~ SimpleCat()
... {
delete itsAge;
delete itsWeight;
}
int main()
... {
using namespace std;
SimpleCat *Frisky =new SimpleCat;
cout << "Frisky is "<< Frisky->GetAge() << "years old"<< endl;
Frisky->SetAge(5);
cout << "Frisky is "<< Frisky->GetAge() << "years old"<< endl;
cout << "Frisky is "<< Frisky->GetWeight() << "years old"<< endl;
Frisky->SetWeight(10);
cout << "Frisky is "<< Frisky->GetWeight() << "years old"<< endl;
delete Frisky;
return 0;
}