나는 비공개 클래스 내에서 구조체를 선언 할과 나는 같은 구조체의 변수에 문자 값을주고 싶어,하지만 난 그것을 초기화 또는 CIN 수 없습니다클래스 내에서 구조체를 선언하려면 어떻게해야합니까?
class puple
{
private:
struct p
{
char name[25];
int grade;
};
public:
puple(){};
void setme()
{
this->p::grade=99;
this->p::name[25]='g'; //here is the problem
}
void printme()
{
cout<<"Name: "<<this->p::name<<endl;
cout<<"Grade: "<<this->p::grade<<endl;
}
};
void main()
{
puple pu1;
pu1.setme();
pu1.printme();
}
숙제 태그가 있어야합니까? – luke