Follow Our FB Page << >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

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 the difference between a template and a macro?

0 Answers  

What is a static member?

0 Answers  

What parameter does the constructor to an ofstream object take?

0 Answers  

Is there any difference between dlearations int* x and int *x? If so tell me the difference?

16 Answers   Lason,

What is c++ best used for?

0 Answers  

Explain the difference between class and struct in c++?

0 Answers  

what is C++ exceptional handling?

0 Answers  

What are the rules for naming an identifier?

0 Answers  

What is #include iomanip?

0 Answers  

explain the reference variable in c++?

0 Answers  

In which memory a class gets stored(in heap /in stack)? And why??

2 Answers  

Define the operators that can be used with a pointer.

0 Answers