Originally posted by Paul Somnath:
@NABILA MOHAMMAD
Remember that a protected class members can be always accessed thorough inheritance but not through references.
Have a look at the following code:
So the say method cannot be accessed through reference.
Can you spot the difference now?
For more explanations, goto K&B: page 34-39..
Have a look at this url for more.
[ September 12, 2008: Message edited by: Paul Somnath ]
Hi Paul,
Thanks for the explanation.
I had already gone through the website as well as the K&B.
However they have both mentioned accessing variable in the Parent class-
which has not been re defined in the child class. If i have defined a say() method in all the three classes - Super,Subone and SubTwo
Or a variable s in all the three - that case how do I call the variable or method in Super or SubOne class because it will always give the value of SubTwo.I mean is it even possible!?
[ September 12, 2008: Message edited by: Nabila Mohammad ]