What is Virtual Function in C++?
If a base class and derived class has same function and if we call the function using pointer of base class that contains address of object of derived class then the function in the base class is executed. So to call the derived class function we have to make the base class function as virtual by adding a virtual keyword in front of function. This function is known as virtual function.
Soon I will write a detailed article on virtual function and share with you.
So stay in touch, keep learning and coding.
Happy Coding!! :):)
No comments:
Post a Comment