Question: C + + I am stuck in trying to fix the error of trying to create an instance object in my main.cpp calling a class
C I am stuck in trying to fix the error of trying to create an instance object in my main.cpp calling a class from character.hpp Snippet of code. Thank you in advanced!
MAIN.cpp:
void characterClass
error is coming from here...
Player player;
int response;
char changeInput;
Staff staff new Staff;
BookSpells bookspells new BookSpells;
Sword sword new Sword;
Shield shield new Shield;
Menu staffmenustaff;
Menu bookmenubookspells;
Menu swordmenusword;
Menu shieldmenushield;
Equip chosenWeapon nullptr;
do
LOGChoose Your Class"
LOG Staff
Book of Spells
Sword
Shield"
std::cin response;
switchraaesponse
case :
cout "Staff DPS: staffmenu.itembonus DEF:" staffmenu.itemdefense endl;
chosenWeapon staff;
break;
CHARACTER.hpp
class Character
private:
int atk;
int def;
int hp;
public:
virtual void equipEquip equipment;
virtual void attackCharacter target;
virtual void special;
void setattackint newatk
atk newatk;
int getattack
return atk;
void setdefenseint newdef
def newdef;
int getdefense
return def;
void sethpint newhp
hp newhp;
int gethp
return hp;
;
class Player : public Character
private:
Equip currentEquipment;
public:
void equipEquip equipment override
setattackcurrentEquipmentgetattackbonus;
setdefensecurrentEquipmentgetdefensebonus;
void attackCharacter target override
bool enemy; logic to determine if target is enemy
ifenemy
int updateHealth targetgethp getattack;
apply damage to target
targetsethpupdateHealth;
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
