d01 ex03 ref and ptr
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
#include "HumanA.hpp"
|
||||
|
||||
HumanA::HumanA( std::string name, Weapon weapon ) {
|
||||
HumanA::HumanA( std::string name, Weapon &weapon ) : _weapon( weapon ) {
|
||||
|
||||
this->_name = name;
|
||||
this->_weapon = &weapon;
|
||||
// this->_weapon = weapon;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
HumanA::~HumanA() {return;}
|
||||
|
||||
void HumanA::attack( void ) {
|
||||
void HumanA::attack( void ) const {
|
||||
|
||||
std::cout << this->_name << " attacks with their ";
|
||||
std::cout << this->_weapon->getType() << std::endl;
|
||||
std::cout << this->_weapon.getType() << std::endl;
|
||||
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user