What is Pure Virtual Function? Why and when it is used ?
Answer Posted / ognas(shradha-asutosh)
in inheritance if the base class contains a virtual
function equating to zero, it is known also as do-nothing
function & that base class is called as abstract base class
as there are no instances or objects can be created by this
base class. And this pure virtual can be filled with the
codes in successiv derived classes accordin to the user
requirements.
The syntax of the pure virtual function is....
class class_name
{
visibility mode:\\should be protected:
virtual return_type function_name()=0;
}
new class_name : inheritance_type old class_name
{
........ //class body
........
}
| Is This Answer Correct ? | 69 Yes | 19 No |
Post New Answer View All Answers
How long will it take to learn programming?
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
What is capacity in vector in c++?
What do you mean by stack unwinding in c++?
What do you mean by persistent and non persistent objects?
How do you define/declare constants in c++?
Why do we use classes in c++?
What data encapsulation is in c++?
Can you declare an array without a size in c++?
What is #include math h in c++?
Can a Structure contain a Pointer to itself?
Explain queue. How it can be implemented?
What are activex and ole?
Can turbo c++ run c program?
Why is c++ still popular?