Study of class hierarchies and the virtual methods