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();
Book_Spells* book_spells = new Book_Spells();
Sword* sword = new Sword();
Shield* shield = new Shield();
Menu staff_menu(staff);
Menu book_menu(book_spells);
Menu sword_menu(sword);
Menu shield_menu(shield);
Equip* chosenWeapon = nullptr;
do{
LOG("Choose Your Class")
LOG("1- Staff
2- Book of Spells
3- Sword
4- Shield")
std::cin >> response;
switch(raaesponse){
case 1:
cout "Staff (DPS:" staff_menu.item_bonus()" DEF:" staff_menu.item_defense()")" endl;
chosenWeapon = staff;
break;
CHARACTER.hpp
class Character {
private:
int atk;
int def;
int hp;
public:
virtual void equip(Equip* equipment)=0;
virtual void attack(Character* target);
virtual void special()=0;
void set_attack(int new_atk){
atk = new_atk;
}
int get_attack(){
return atk;
}
void set_defense(int new_def){
def = new_def;
}
int get_defense(){
return def;
}
void set_hp(int new_hp){
hp = new_hp;
}
int get_hp(){
return hp;
}
};
class Player : public Character{
private:
Equip* currentEquipment;
public:
void equip(Equip* equipment) override{
set_attack(currentEquipment->get_attack_bonus());
set_defense(currentEquipment->get_defense_bonus());
}
void attack(Character* target) override{
bool enemy; // logic to determine if target is enemy
if(enemy){
int updateHealth = target->get_hp()- get_attack();
// apply damage to target
target->set_hp(updateHealth);
}
}
};
C + + I am stuck in trying to fix the error of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!