#include#include "animal/pet.h" int main() { Animal::Pet myPet; std::cout << "Maximum health: " << myPet.GetMaxHealth() << std::endl; return 0; }
Maximum health: 100
#include#include "animal/pet.h" int main() { Animal::Pet myPet; std::cout << "Maximum health before change: " << myPet.GetMaxHealth() << std::endl; myPet.SetMaxHealth(200); std::cout << "Maximum health after change: " << myPet.GetMaxHealth() << std::endl; return 0; }
Maximum health before change: 100 Maximum health after change: 200This example creates a Pet object named myPet and calls the GetMaxHealth function to get the maximum health points that the pet can have. Then, the SetMaxHealth function is called to change the maximum health points to 200. Finally, the GetMaxHealth function is called again to get the new maximum health points. The output will be "Maximum health before change: 100" and "Maximum health after change: 200".