include <iostream>
using namespace std;
class Player
{
private:
string _name = "unnamed";
int _level = 1;
public:
Player(string& name, int level);
void set_name(string &name);
void set_level(int level);
string name();
int level() const;
};
Player::Player(string& name, int level){
set_name(name);
set_level(level);
}
void Player::set_name(string &name)
{
_name = name;
}
void Player::set_level(int level)
{
_level = level;
}
string Player::name()
{
return _name;
}
int Player::level() const
{
return _level;
}
int main()
{
string name = string("凌");
Player player(name,99);
cout<< player.name()<<endl;
cout<< player.level()<<endl;
player.set_level(100);
cout<< player.level()<<endl;
return 0;
}