#include <iostream>
class character {
int health; // health instance private by default
int damage; // damage instance private by default
public:
character(int h) { h = health ; } // character constructor
int get_health() { return health; } // accessor function to return characters health
int get_damageDone() { return health - damage; }
};
int main()
{
character God(100);
character Satan(100);
int gH = God.get_health(), sH = Satan.get_health();
std::cout << "God's health is " << gH << "\n";
std::cout << "Satan's health is " << sH << "\n";
std::cin.get();
return 0;
}
It's outputting results lke -858993460 :S. Can someone tell me why?