im working on a simple program.. but it constantly crashes. i have absolutely no idea why. ill start the program.. write my name.. press enter. and it gives me the windows error "send bug report" thing.. could somebody take a look and try to explain why?
Code:
#include <iostream>
#include <string>
using namespace std;
class Character{
public:
Character(){
Health = 100;
Level = 1;
};
~Character(){};
string getName(){
return name;
};
string getClass(){
return Class;
};
int getAttack(){
return Attack;
};
int getDefense(){
return Defense;
};
int getLevel(){
return Level;
};
int getHealth(){
return Health;
};
string setName(string n){
n = name;
};
protected:
string name;
string Class;
int Attack;
int Defense;
int Level;
int Health;
};
class Monster: public Character{
};
int main(){
Character Player;
Character * pPlayer = &Player;
string dName;
cout<<"player name\n";
cin>>dName;
pPlayer->setName(dName);
cin.get();
cout<<"name is"<<Player.getName()<<"\n";
cout<<"player Class\n";
cin.get();
};
im using dev-cpp if its of any concelation