Question: Learning Objective: To create a class with 2 class methods, and get and display and set the values for the member variables with the functions.

Learning Objective:
To create a class with 2 class methods, and get and display and set the values for the member variables with the functions.
Part 1 Instructions:
Create and define a class called Player
Create 5 member variables
string name;
int score;
int health_status;
string weapon;
int strength;
and 2 class methods (member functions), one to input, and another one to output.
void input(); //you may chose to leave empty, or add parameters
void outupt();
Define your class methods outside of the class definition and outside of main using the scope resolution.
EXAMPLE: void Player::input(){//code goes here }
Member variables should be private, and functions should be public.
In main create 2 objects and apply the input function to both, as well as the output function to both.
NOTE: You may not use your member variables inside of main, only use your functions to access member variables.

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 Programming Questions!