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
program explaining feautures of c++
Differentiate between a copy constructor and an overloaded assignment operator.
What is the keyword auto for?
How is new() different from malloc()?
What are the various arithmetic operators in c++?
What is fixed in c++?
Write a code/algo to find the frequency of each element in an array?
Why do we learn c++?
What is the size of integer variable?
What is static in c++?
Given the following seqment of code containing a group of nested if instructions: y = 9; if ((x==3) || (x == 5)) y++; else if (x == 2) y *= 2; else if (x == ) y-= 7; else y = 8; if the value of x is 4 before the nested IFs are executed, what is the value of y after the nested IFs are executed?
Define copy constructor.
Differentiate between C and C++.
What are c++ files?
What is a try block?