Share this post! | Vote this! |
|
We will present a simple database program with a virtual function to
show how it can be used, then we will go on to illustrate a more complex
use of the virtual function in a manner that finally illustrates its
utility and reason for existence.
Declaration of a virtual function more...
So what is a Virtual Function?
A Virtual function is a function which is declared in base class using the keyword virtual. We write the body of virtual function in the derived classes. Its purpose is to tell the compiler that what function we would like to call on the basis of the object of derived class. C++ determines which function to call at run time on the type of object pointer to.Declaration of a virtual function more...
0 comments:
Post a Comment