class Unit
{
protectedint health;
publicint GetHealth()
{
return health;
}
publicvoid SetHealth(int p_health)
{
health = p_health;
}
public Unit() // default constructor
{
health = 100;
}
public Unit(int p_fuel)
{
health = p_fuel;
}
};
class Footman : Unit
{
privateint weapons { get; set; } // what could be the usage of this
public Footman(int damage)
{
weapons = damage;
}
};
How did I know? I didn't know for sure because I have never used C# but I have seen people posting C# code here before. The giveaway was that public/protected/private was applied for each member and the use of the { get; set; } syntax.
Yes it's obvious protected: int health in c++ instead of what I wrote. I should have adapted the code for c++ since this is a c++ forum, but at a first glance I thought that the differences are not very noticeable.