-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPotions.cpp
50 lines (42 loc) · 911 Bytes
/
Potions.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
44
45
46
47
48
49
50
#include "Potions.h"
#include <cstring>
Potion::Potion()
{
this->name = nullptr;
this->bonusHealth = 0;
this->setDurability(0);
}
Potion::Potion(const char* name, int bonusHealth)
{
this->name=nullptr;
this->setName(name);
this->setBonusHealth(bonusHealth);
this->setDurability(0);
}
Potion::Potion(const Potion& other)
{
this->setName(other.getName());
this->setBonusHealth(other.getBonusHealth());
this->setDurability(other.getDurability());
}
Potion& Potion::operator=(const Potion& other)
{
if (this!=&other)
{
this->setName(other.getName());
this->setBonusHealth(other.getBonusHealth());
this->setDurability(other.getDurability());
}
return *this;
}
void Potion::setBonusHealth(int bonus)
{
this->bonusHealth=bonus;
}
const int Potion::getBonusHealth() const
{
return this->bonusHealth;
}
Potion::~Potion()
{
}