C++
Programming and Technical
What are virtual functions?
Read Solution (Total 1)
-
- A virtual function is one which has the same name in the base and sub class with the same number of parameters and return type of parameters.
A *ptr;// A base class
A aobj;
B bobj;
ptr=&a;
ptr->display();// display() virtual method , this invokes base class method
ptr=&b;
ptr->display();// display() this invokes sub class method
- 9 years agoHelpfull: Yes(0) No(0)
C++ Other Question