I have a class A and class B. Class B inherits from A. Class A has a protected member x.
Class B has a method m which calls another method m1. In m1 I access A.x and set it to some value. The wierd thing is that when I try to access A.x in m after calling m1, it seems that A.x was not set at all.
I'd like to know if there's a proper way to access class A member x from B other than A.x.
If I understand your question correctly then the problem with what you are doing is, you are using A.x to access x. However since B is inherited from A and x is a data member of A, so when you inherit B, A's data member will be inherited to B if the data members are public or protected. So to solve the problem instead of using A.x just use x