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
What is the function to call to turn an ascii string into a long?
What do you mean by inheritance in c++?
How c functions prevents rework and therefore saves the programers time as wel as length of the code ?
When we use Abstract Class and when we use Interface?where we will implement in real time?
What is the latest c++ version?
Can class objects be passed as function arguments?
What is a class template?
What is fflush c++?
What are the implicit member functions of class?
Explain terminate() and unexpected() function?
What is a wchar_t in c++?
What is null pointer and void pointer?
What is the use of setprecision in c++?
What are the various oops concepts in c++?
What is data binding in c++?