virtual function is a function in the parent class that allows to be overridden (allowing for dynamic polymorphism).
with virtual function (in C++) there is a special virtual pointer table that is generated by compiler to track functions ). hence sizeof(class) will be usual size + sizeof(ptr)
if function is not declared virtual and overridden always the function in parent gets called.