How can I access "k.a"?Code:class x{int a;}; class y:public x{}; main(){y k; k.a=3; }
PS: You can't change or omit any part of the code.
a have to be private.
Member access specifier have to be public ( class y: public x ).
You can add functions to x class but you can't add data members to x class.
You can add functions to y class too.
-> Maybe we need to type a friend function.