In reply to Deepthip:
The type of the class variable alone determines which printA method gets called. Since you override printA in the “child” class, and you use the same class variable type to reference it, the child class method is what gets called.
See my article on OOP inheritance:
Also, see this post about my dislike of parent/child terminology.