🔒 Closed C++ Constructor error

Status
Not open for further replies.

Welcome Guest

Established
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;
}
 
Status
Not open for further replies.

About this Thread

  • 0
    Replies
  • 381
    Views
  • 1
    Participants
Last reply from:
Welcome Guest

Online now

Members online
1,004
Guests online
724
Total visitors
1,728

Forum statistics

Threads
2,276,959
Posts
28,973,344
Members
1,229,665
Latest member
hellowwolrd
Back
Top