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 latest version on c++?

0 Answers  


What is iomanip c++?

0 Answers  


What's the order in which the local objects are destructed?

0 Answers  


What is optimization in c++? when using volatile.optimization is not possible..what does this mean?

1 Answers  


Can we specify variable field width in a scanf() format string? If possible how?

0 Answers  






What are the five basic elements of a c++ program?

0 Answers  


sizeof - is it a function or operator?

6 Answers   Honeywell,


how to create window program in c++.please explain.

1 Answers   Microsoft,


When you overload member functions, in what ways must they differ?

0 Answers  


can output 5 students using one dimensional array

1 Answers   Intel,


What is protected inheritance?

0 Answers  


What is volatile and pragma? When they are used?

1 Answers  


Categories