What's new

C++ Constructor error

Welcome Guest

Eternal Poster
Joined
Nov 29, 2015
Posts
1,002
Reaction
148
Points
509
Age
27
Mga master ano po ba mali dito, bat ayaw mag run. Pa help po pls

C++:
#include <iostream>
#include <string>
using namespace std;

class Player{
    public:
        string name;
        string type;
        int level;
        int hp;
        int mp;

    Player (string _name, string _type, int _level, int _hp, int _mp){
        name = _name;
        type = _type;
        level = _level;
        hp = _hp;
        mp = _mp;

        cout << Player << " has been created." << endl;
    }
};

int main()
{

    Player playerOne("Raijin", "Archer", 10, 1000, 500);
    Player playerTwo("Liyamin", "Warrior", 20, 2000, 110);


    return 0;
}
 

Similar threads

Back
Top