Code:
#include <iostream>
using namespace std;
class Sprite{
private:
int HP;
int MP;
int Att;
int Def;
int Lvl;
public:
Sprite(int hp, int mp, int att, int def);
~Sprite();
int getHP(){return HP;}
int getMP(){return MP;}
int getAtt(){return Att;}
int getDef(){return Def;}
int getLvl(){return Lvl;}
void LvlUP();
};
Sprite::Sprite(int hp, int mp, int att, int def){
Lvl=1; HP=hp; MP=mp; Att=att; Def=def;
}
void Sprite::LvlUP(){
Lvl++;
HP += Lvl*5;
MP += Lvl;
Att += Lvl;
Def += Lvl;
}
int main(){
/*A pointer that points to the whole class, and can de-reference anything inside of it*/
Sprite *Sebba = new Sprite(50,10,5,5);
cout << "Sebba has "<<Sebba->getHP()<<" hit points." <<endl;
Sebba->LvlUP();
cout << "Sebba now has "<<Sebba->getHP()<<" hit points." <<endl;
return 0;
}