P
psp
I'm really puzzled why this is allowed by the c++ compiler:
class C {
public:
void setNumber( int y ) { m_y = y; }
void printNumber() const { cout << "m_y= " << m_y << endl; }
void copyInt(C &anotherCObj) { m_y = anotherCObj.m_y; }
private:
int m_y;
};
Is there a c++ rule/specification that allows access to private
members of a class if accessed from the same class.
class C {
public:
void setNumber( int y ) { m_y = y; }
void printNumber() const { cout << "m_y= " << m_y << endl; }
void copyInt(C &anotherCObj) { m_y = anotherCObj.m_y; }
private:
int m_y;
};
Is there a c++ rule/specification that allows access to private
members of a class if accessed from the same class.