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

Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.

0 Answers   Nucleus, TCS,


What are default parameters? How are they evaluated in c++ function?

0 Answers  


Are vectors faster than arrays?

0 Answers  


Difference between linked list and array?

3 Answers  


Explain some examples of operator overloading?

0 Answers  


What is the difference between function overloading and operator overloading?

0 Answers  


Difference between static global and global?

16 Answers   Microsoft, Symphony, Wipro,


How to give an alternate name to a namespace?

0 Answers  


What is the basic of c++?

0 Answers  


Do you know the problem with overriding functions?

0 Answers  


What is the difference between stack and heap memory?

1 Answers  


write a function signature with various number of parameters.

0 Answers  


Categories