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 oop in c++?

1 Answers  


What is singleton pattern in c++?

1 Answers  


What is the use of c++ programming language in real life?

1 Answers  


What is ios class in c++?

1 Answers  


What is token c++?

1 Answers  


When are exception objects created?

1 Answers  


Is c++ pass by reference or value?

1 Answers  


Where are setjmp and longjmp used in c++?

1 Answers  


What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator?

1 Answers  


Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)

1 Answers  


What is object in c++ wikipedia?

1 Answers  


Who was the creator of c++?

1 Answers  


Categories