c++问题
# include<iostream>using namespace std;
class CUser{
private:
char *L_UserName;
char *L_UserPassword;
public:
CUser(){
strcpy(this->L_UserName,"SUNKAI");
strcpy(this->L_UserPassword,"123");
}
char *GetUserName()const{
return L_UserName;
}
char *GetUserPassword()const{
return L_UserPassword;
}
};
void main(){
CUser user;
cout<<user.GetUserName()<<endl;
cout<<user.GetUserPassword()<<endl;
}
以上程序在编译是也没出错,可是在运行时却说什么ClassObject.exe遇到关闭问题,出现不了预想的结果。