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

How to declaring variables in c++?

0 Answers  


Can you explain the term "resource acquisition is initialization?"

1 Answers   Amazon,


What is object in c++ example?

0 Answers  


A mXn matrix is given and rows and column are sorted as shown below.Write a function that search a desired entered no in the matrix .with minimum complexity 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

0 Answers  


How can you link a c++ program to c functions?

0 Answers  






Why is c++ is better than c?

0 Answers  


Why seem interrupt handlers as member functions to be impossible?

1 Answers  


Why are pointers used?

0 Answers  


Can I run c program in turbo c++?

0 Answers  


How the keyword struct is different from the keyword class in c++?

0 Answers  


What is null pointer and void pointer?

0 Answers  


what are the types of Member Functions?

0 Answers  


Categories