|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
• |
Purpose
|
|
|
|
– |
set
up an object: i.e. instantiate an object.
|
|
|
• |
How
|
|
|
|
– |
Constructor
automatically invoked at declaration time
|
|
|
• |
Player
John; //default constructor
|
|
|
|
Player::Player(int s, int a) {
|
|
|
|
strength = stg;
|
|
|
|
agility = agl;
|
|
|
|
health = 10;
|
|
|
|
}
|
|
|
|
Player
Jane(20, 5); //function overloading
|
|