Generation

generate functionWed, 24 May 2023

generate object as have a size, age and waight

class Cat { public: Cat(int initAge); ~Cat(); int GetAge(); void SetAge(int age); void Meow(); private: int itsAge; }; int main() { Cat Frisky(5); Frisky.Meow(); cout << "Frisky is a cat who is "; cout << Frisky.GetAge() << " years old.\n"; Frisky.Meow(); Frisky.SetAge(7); cout << "Now Frisky is " ; cout << Frisky.GetAge() << " years old.\n"; return 0; } Cat::Cat(int initAge) { itsAge = initAge; } Cat::~Cat() {} int Cat::GetAge() { return itsAge; } void Cat::SetAge(int age) { itsAge = age; } void Cat::Meow() { cout << "Me

Questions about programming?Chat with your personal AI assistant