64,654
社区成员
发帖
与我相关
我的任务
分享
class C
{
private:
struct S;
S * handle;
public:
......
};
Student::Student(const Student& stu){
//在这个深拷贝中 m_pcName是Student的private成员,为什么可以用stu.m_pcname来调用这个私有成员呢
//类的对象怎么能访问私有成员呢,但是它编译居然还通过了,
this->m_pcName = new char[strlen(stu.m_pcName) + 1];
strcpy(this->m_pcName, stu.m_pcName);
cout < < "construct copy of" < < stu.m_pcName < <endl;
}