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 best book for c++ beginners?

590


Why c++ is faster than java?

606


What does it mean to declare a destructor as static?

631


You run a shell on unix system. How would you tell which shell are you running?

667


Show the application of a dynamic array with the help of an example.

599






What are guid? Why does com need guids?

582


Why are pointers not used in c++?

637


what is scupper?

1899


describe private access specifiers?

656


What are the steps in the development cycle?

625


Explain the benefits of proper inheritance.

648


What is pointer in c++ with example?

528


What is ofstream c++?

595


What is a loop? What are different types of loops in c++?

608


How is new() different from malloc()?

643