求解一个关于结构的问题
#include<iostream.h>class student
{
private:
struct pimpl;
pimpl m_pimpl;
public:
student(char * name,int age):m_pimpl.m_name(name),m_pimpl.m_age(age)
{}
void show();
};
struct student::pimpl
{
char * m_name;
int m_age;
};
void student::show()
{
cout<<"姓名 :"<<m_pimpl.m_name<<endl;
cout<<"年龄 :"<<m_pimpl.m_age<<endl;
}
int main()
{
student a1("谢谢",24);
a1.show();
return 0;
}
总是编辑不出结果 望相助