What is a 'pure' virtual function and what's its use?
Answer Posted / 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 View All Answers
What is istream c++?
What methods can be overridden in java?
How does a C++ structure differ from a C++ class?
What is the latest c++ version?
What are the advantages of using typedef in a program?
Why cout is used in c++?
Explain the extern storage classes in c++.
What do you mean by const correctness?
Is c++ still in demand?
Differentiate between an external iterator and an internal iterator? What is the advantage of an external iterator.
Can a list of string be stored within a two dimensional array?
What does extern mean in a function declaration in c++?
Is oops and c++ same?
What is void pointer in c++ with example?
What parameter does the constructor to an ofstream object take?