-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayer.cpp
44 lines (39 loc) · 873 Bytes
/
player.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// Created by 200458668 on 11/15/2020.
//
#include "player.hpp"
void Player::RollDice() {
this->_dice->RollDice();
std::cout << _name << " rolls his dice \n";
this->_dice->ShowDice(std::cout);
}
void Player::SetScore() {
++_score;
}
int Player::GetDice() const{
return _dice->GetTotal();
}
void Player::SetDice(Dice *dice) {
_dice = dice;
}
void Player::SetName(std::string name) {
_name = name;
}
int Player::GetScore() const {
return _score;
}
std::string Player::GetName() const {
return _name;
}
Player::~Player() {
delete _dice;
}
bool Player::operator>(const Player &player) const {
return this->_score > player._score;
}
bool Player::operator==(const Player& player) const{
return this->_score == player._score;
}
bool Player::operator<(const Player &player) const {
return this->_score < player._score;
}