What is a 'pure' virtual function and what's its use?



What is a 'pure' virtual function and what's its use?..

Answer / 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

More C++ General Interview Questions

what is oops and list its features in c++?

0 Answers  


What is the difference between passing by reference and passing a reference?

0 Answers  


What is atoi?

0 Answers  


When should we use container classes instead of arrays?

0 Answers  


What is an ABC: an "Abstract Base Class"?

1 Answers  






Is recursion allowed in inline functions?

0 Answers  


Write a program using merge () function to combine the elements of array x[ ] and y[ ] into array z[ ].

0 Answers  


What are the stages in the development cycle?

0 Answers  


Do vectors start at 0 c++?

0 Answers  


What is lambda in c++?

0 Answers  


How do I get good at c++ programming?

0 Answers  


Explain container class.

0 Answers  


Categories