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

A mXn matrix is given and rows and column are sorted as shown below.Write a function that search a desired entered no in the matrix .with minimum complexity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

3253


What is the keyword auto for?

580


Tell me can a pure virtual function have an implementation?

562


What is static function? Explain with an example

568


What is difference between n and endl in c++?

590






What is stack unwinding?

615


Can c++ be faster than c?

611


How do you flush a buffer in c++?

612


Define the operators that can be used with a pointer.

585


What is abstract keyword in c++?

597


Define a conversion constructor?

629


Which command properly allocates memory a) char *a=new char[20]; b) char a=new char[20]; c) char a=new char(20.0);

625


Differentiate between a pointer and a reference with respect to c++.

705


What is oops in c++?

601


what kind of projects are suitable for c and c++

631