What is a 'pure' virtual function and what's its use?
Answer Posted / phool chand
A pure virtual function is signified by using `=0;' in place of the body of the function. The presence of a pure virtual function prevents instantiation of the class which contains it. For this to be of any use, a derived class must implement the pure virtual function. I.e. the derived class must provide a function with the same name which includes a function body.
The basic reason for pure virtual functions is to specify something that a class can do without specifying how the class will do it.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to implement is-a and has-a class relationships?
What are pointer-to-members in C++? Give their syntax.
What is encapsulation in C++? Give an example.
What are manipulators used for?
To what does “event-driven” refer?
What do you mean by stack unwinding in c++?
How many ways can a variable be initialized into in C++?
What is a tree in c++?
What is type of 'this' pointer? Explain when it is get created?
Write a program to find the reverse Fibonacci series starting from N.
What does I ++ mean in c++?
Explain the use of vtable.
What is pair in c++?
What does the ios::ate argument do?
What is the use of this pointer in c++?