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 data structure in c++?
Difference between Abstraction and encapsulation in C++?
What is abstract keyword in c++?
What is the best it certification?
What is functions syntax in c++?
Is vector a class in c++?
What do you mean by translation unit?
What are the differences between the function prototype and the function defi-nition?
What is meant by forward referencing and when should it be used?
Does c++ have string data type?
How the endl and setw manipulator works?
How many types of modularization are there in c++?
What is encapsulation in c++?
How do you save a c++ program?
What is a string example?