Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C + + Create a Character class - a character that encapsulates the fields: string name; - first name; int life; - life (
In C Create a Character class a character that encapsulates the fields:
string name; first name;
int life; life ;
char path; route, saves the last walking directions directions ttop, bbottom, lleft, rright;
can be supplemented if necessary
and methods:
Characterstring int; constructor, sets fields name and life;
bool Hitint; reduces the character's life by the value of the parameter, returns whether the character is alive;
int GetLife; returns the amount of life of the character;
void Gochar; adds walking direction;
void PrintCharacter; outputs the name, alive then also outputs the number of life points or dead, the last moves
~Character; destructor, outputs the message "Game over for name"
can be supplemented if necessary
Rules:
A character can only be created with life
If a character runs out of life, it is considered dead.
Only the PrintCharacter function works for a dead character, and of course ~Character
For the Gochar function, implement the input data correctness check tblr only
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started