#include <iostream>
using namespace std;
class person
{
private:
int health;
int stregnth;
public:
int health1()
{
return 40;
}
void attack()
{
cout << " now attacking!!";
}
void increasehealth()
{
health++ ;
}
void decreasehealth()
{
health-- ;
}
};
int main ()
{
person a;
a.health1();
char f;
cin >>f;
return 0;
}
It is returning a value. It returns 40. To print it, you do cout <<a.health1() <<endl;