Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
gaming-project/health class
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
60 lines (45 sloc)
811 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> | |
using namespace std; | |
class health | |
{ | |
private: | |
int player, monster; | |
string level; | |
public: | |
void setPlayer(int _player) | |
{ | |
player = _player; | |
} | |
int getPlayer() | |
{ | |
return player; | |
} | |
void setMonster(int _monster) | |
{ | |
monster = _monster; | |
} | |
int getMonster() | |
{ | |
return monster; | |
} | |
string getLevel(string _level) | |
{ | |
return level; | |
} | |
}; | |
#include "health.h" | |
#include <string> | |
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
health playerhealthobj; | |
playerhealthobj.setPlayer(100); | |
cout << playerhealthobj.getPlayer() << endl; | |
{ | |
health monsterhealthobj; | |
monsterhealthobj.setMonster(90); | |
cout << monsterhealthobj.getMonster()<< endl; | |
} | |
} | |