en cours de debug d01 ex03

This commit is contained in:
hugogogo
2022-02-06 10:50:35 +01:00
parent c1990815e2
commit 3708a135be
5 changed files with 13 additions and 5 deletions

View File

@@ -5,11 +5,16 @@ HumanA::HumanA( std::string name, Weapon weapon ) {
this->_name = name; this->_name = name;
this->_weapon = &weapon; this->_weapon = &weapon;
return;
} }
HumanA::~HumanA() {} HumanA::~HumanA() {return;}
void HumanA::attack( void ) { void HumanA::attack( void ) {
std::cout << this->_name << " attacks with their " << this->_weapon->getType() << std::endl; std::cout << this->_name << " attacks with their ";
std::cout << this->_weapon->getType() << std::endl;
return;
} }

View File

@@ -7,7 +7,7 @@ HumanB::HumanB( std::string name ) {
} }
HumanB::~HumanB() {} HumanB::~HumanB() {}
void setWeapon( Weapon weapon ) { void HumanB::setWeapon( Weapon weapon ) {
this->_weapon = &weapon; this->_weapon = &weapon;

View File

@@ -3,6 +3,7 @@
Weapon::Weapon( std::string type ) { Weapon::Weapon( std::string type ) {
this->_type = type; this->_type = type;
std::cout << "weapon constructor received : " << this->_type << std::endl;
} }
Weapon::~Weapon() {} Weapon::~Weapon() {}
@@ -10,11 +11,13 @@ Weapon::~Weapon() {}
std::string Weapon::getType( void ) { std::string Weapon::getType( void ) {
return this->_type; return this->_type;
std::cout << "weapon getType() return : " << this->_type << std::endl;
} }
void Weapon::setType( std::string type ) { void Weapon::setType( std::string type ) {
this->_type = type; this->_type = type;
std::cout << "weapon setType() received : " << this->_type << std::endl;
} }

View File

@@ -11,7 +11,7 @@ public:
Weapon( std::string type ); Weapon( std::string type );
~Weapon(); ~Weapon();
std::string getType( void ); std::string getType();
void setType( std::string type ); void setType( std::string type );
private: private:

BIN
d01/ex03/war Executable file

Binary file not shown.