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 can virtual functions in c++ be implemented?
Explain the concept of dynamic allocation of memory?
What is malloc in c++?
What is the difference between the indirection operator and the address of oper-ator?
What is binary object model?
What do you mean by inheritance in c++? Explain its types.
What is else if syntax?
Why cstdlib is used in c++?
Describe friend function & its advantages.
What do the keywords volatile and mean mutable?
What are the general quetions are in DEna bank manager IT/System interviews?
Who calls main function?
an operation between an integer and real always yeilds a) integer result b) real result c) float result
What are the sizes and ranges of the basic c++ data types?
What is set in c++?