Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Can you write a function similar to printf()?

1079


If horse and bird inherit virtual public from animal, do their constructors initialize the animal constructor? If pegasus inherits from both horse and bird, how does it initialize animal’s constructor?

1148


What does it mean to declare a destructor as static?

1017


Are c and c++ similar?

997


What are the various access specifiers in c++?

980


What are single and multiple inheritances in c++?

1033


Explain what happens when a pointer is deleted twice?

1193


Explain virtual class and friend class.

995


Is there a sort function in c++?

936


How is computer programming useful in real life?

1001


What is pure virtual function? Or what is abstract class?

1005


Are strings mutable in c++?

1089


What is the auto keyword good for in c++?

1118


What is the use of seekg in c++?

991


What is a wchar_t in c++?

1059