PPL Assignment
IRM2015006
Main Page
Classes
Files
File List
File Members
generousboy.cpp
Go to the documentation of this file.
1
#include "
generousboy.h
"
2
3
GenerousBoy::GenerousBoy
(std::string name,
int
attr,
int
intel,
int
budget,
int
min_attr_req)
4
{
5
this->name =
name
;
6
this->intel =
intel
;
7
this->attr =
attr
;
8
this->budget =
budget
;
9
this->min_attr_req =
min_attr_req
;
10
this->
committed
=
false
;
11
this->
happiness
= 0;
12
this->
girlfriend
= NULL;
13
this->
gifts
= NULL;
14
}
15
float
GenerousBoy::getHappiness
()
16
{
17
float
happiness
= 0;
18
if
(!
committed
|| !
girlfriend
|| !
gifts
)
19
return
-1;
20
21
happiness = this->
girlfriend
->
getHappiness
();
22
this->happiness =
happiness
;
23
return
happiness
;
24
}
25
26
BoyNature
GenerousBoy::getNature
()
27
{
28
return
nature
;
29
}
Boy::committed
bool committed
Definition:
boy.h:32
Girl::getHappiness
virtual float getHappiness()=0
Boy::attr
int attr
Definition:
boy.h:25
Boy::gifts
std::vector< Gift > * gifts
Definition:
boy.h:33
Boy::happiness
float happiness
Definition:
boy.h:29
GenerousBoy::getNature
BoyNature getNature() override
Definition:
generousboy.cpp:26
Boy::min_attr_req
int min_attr_req
Definition:
boy.h:28
Boy::budget
int budget
Definition:
boy.h:27
Boy::intel
int intel
Definition:
boy.h:26
Boy::name
std::string name
Definition:
boy.h:24
GenerousBoy::getHappiness
float getHappiness() override
Definition:
generousboy.cpp:15
generousboy.h
GenerousBoy::nature
static const BoyNature nature
Definition:
generousboy.h:12
Boy::girlfriend
Girl * girlfriend
Definition:
boy.h:30
BoyNature
BoyNature
Definition:
boy_type.h:5
GenerousBoy::GenerousBoy
GenerousBoy(std::string name, int attr, int intel, int budget, int min_attr_req)
Definition:
generousboy.cpp:3
boys
generousboy.cpp
Generated by
1.8.11