Question: Goal: Learn how to write class definitions with constructors taking parameters. Assignment: Imagine you're creating a character for an adventure game, where each character has
Goal: Learn how to write class definitions with constructors taking parameters.
Assignment: Imagine you're creating a character for an adventure game, where each character has various attributes that define their abilities, such as strength, intelligence, and agility.
Given the GameCharachter.h header file, defined as such:
class GameCharacter
private:
int strength;
int intelligence;
int agility;
public:
GameCharacterint int, int;
int getStrength const;
int getIntelligence const;
int getAgility const ;
int getLevel const;
void increaseStrengthint;
void increaseIntelligenceint;
void increaseAgilityint;
;
Write the implementation of the constructor that takes in three integer values as parameters representing the strength, intelligence, and agility attributes in this order and assigns them to the correct class member.
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
