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 virtual function?

Answer Posted / varun sir

a virtual function is used to avoid duplicacy in derived
classes. suppose that there is a base class which has two
properties a and b. now suppose that two derived classes
named 'der1' and 'der2' are deriving from that base class,
then both properties a and b of base class will be
inherited to both of the derived classes. now if a new
class is derived from 'der1' and 'der2' then both of the
properties a and b of 'der1' and 'der2' will also be
inherited into newly derived class. this will cause
duplicacy in newly obtained derived class. so in order to
avoid this duplicacy , we use virtual functions.

Is This Answer Correct ?    8 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use oop?

1040


What does and I oop and sksksk mean?

1107


What are the 4 main oop principles?

1162


What is class encapsulation?

1029


any one please tell me the purpose of operator overloading

2338


What is polymorphism and why is it important?

981


What is cohesion in oop?

1007


Will I be able to get a picture in D drive to the c++ program? If so, help me out?

2139


Can we define a class within the interface?

986


What are the important components of cohesion?

968


What is class in oop with example?

1039


What is the advantage of oop over procedural language?

1006


What is the purpose of enum?

964


What are two types of polymorphism?

1013


What is byval and byref? What are differences between them?

2149