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


Please Help Members By Posting Answers For Below Questions

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

653


Write about the members that a derived class can add?

655


Write a program to interchange 2 variables without using the third one.

675


what is data encapsulation in C++?

703


Can java be faster than c++?

763






What is basic if statement syntax?

646


What language does google use?

691


What are c++ files?

681


If a base class declares a function to be virtual, and a derived class does not use the term virtual when overriding that class, is it still virtual when inherited by a third-generation class?

695


How do I download c++?

651


What is stoi in c++?

802


Explain the use of vtable.

714


What do you understand by zombie objects in c++?

718


Why is polymorphism useful?

669


What is the difference between set and map in c++?

723