Hey all,
I'm probably missing something obvious, but why the HELL does this copy constructer work?
That's the class, here's the code:Code:class StrType { char *p; int size; public: StrType(const StrType &o); // copy constructor ~StrType() { delete [] p; } };
Now howcome the copy constructer above can access those private members of 'o'?Code:StrType::StrType(const StrType &o) { size = o.size; p = new char[size]; strcpy(p, o.p); }
Thanks.