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
What is the extension of c++?
What is enum c++?
What is a float in c++?
Is c++ slower than c?
What is setiosflags c++?
Can we run c program in turbo c++?
What is an accessor in c++?
How do you add an element to a set in c++?
What is pointer with example?
Is the declaration of a class its interface or its implementation?
Describe friend function & its advantages.
Why the usage of pointers in C++ is not recommended ?
How many static variables are created if you put one static member into a template class definition?
What is a namespace in c++?
What is namespace & why it is used in c++?