In reply to prasadaddagarla:
Prashant,
The polymorphism applies to virtual methods. In this example P1 is pointing to a derived object and hence accesses “modified/derived virtual method named printB” - that method has access to all values in the DERIVED class, including C. The variable hiding is more of inheritance phenomenon.
HTH
Srini
www.verifworks.com