Question: 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
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
