Virtual Function

Function is a virtual function when the virtual keyword is added in the beginning of function declaration.
virtual keyword is required…