1
Reply

What is the Difference between Abstract Function and Virtual Function ?

Vijay Kumar

Vijay Kumar

10y
1.8k
0
Reply

    Abstract function:--> 1) An abstract function has no implementation. It can only be declared. This forces the derived class to provide the implementation of it. 2) Abstract means we MUST override it. 3) An abstract member is implicitly virtual. Abstract can be called as pure virtual in some of the languages. Virtual Function:--> 1) Virtual Function has an implementation. When we inherit the class we can override the virtual function and provide our own logic. 2) We can change the return type of Virtual function while implementing the function in the child class(which can be said as concept of Shadowing). 3) Virtual means we CAN override it.