What is Pure Virtual Function? Why and when it is used ?

Answer Posted / shakti singh

A virtual function in a base class which is equated to 0 is called a pure virtual function.The class then is called a Abstract Base Class or in general ABC.No object of such class can be instantiated.ABC in general acts as an interface and implement the general flow of algorithm.A pure virtual function must be overloaded in the derived class otherwise the compiler will throw an error.
A pure virtual function do nothing and it is not concerned with the implementation detail.

Is This Answer Correct ?    13 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the extension of c++?

510


What are the advantages of prototyping?

560


What is null pointer and void pointer?

620


What data encapsulation is in c++?

592


What is the use of :: operator in c++?

594






How do you clear a set in c++?

601


Define Virtual function in C++.

619


What is the header file for setw?

573


Is python written in c or c++?

614


What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random

647


Why is c++ so fast?

529


Which software is best for programming?

656


Write about the role of c++ in the tradeoff of safety vs. Usability?

591


What is meant by a delegate?

606


Is C++ case sensitive a) False b) Depends on implementation c) True

610