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 / nk

A virtual function is basically a like normal function but
we can override the function in the derived classes.
Now when we want to access like (fn)

Base * bptr = new Derived();
bptr->fn(); then function of the derived class will be
called only if the function is marked as virtual in the
base class.

i.e the virtual keywork tells to use the function of the
class to which it is pointing to and not to the Base class.
This is called runtime polymorphism.

Is This Answer Correct ?    24 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

when to use 'mutable' keyword and when to use 'const cast' in c++

2165


Which method cannot be overridden?

1104


What is abstract class in oop?

1018


What are oops methods?

1023


What is encapsulation c#?

1091


What are the 3 pillars of oop?

1197


What is overloading in oop?

1016


What is polymorphism give a real life example?

1045


What is oops with example?

1058


What is the main feature of oop?

1151


How can you overcome the diamond problem in inheritance?

1184


What is the significance of classes in oop?

1163


What is a class in oop?

1140


What are the 5 oop principles?

1132


What is the diamond problem in inheritance?

1147