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 in c++

Answers were Sorted based on User's Feedback



what is virtual function in c++..

Answer / achal

the concept of vitual function comes when inheritance is at
work. If the overriden function is not made virtual in base
class , then pointer of derived class will call the funtion
in base class(instead it should have called the one from
derived class.)
this is why we make the function in base as virtual.

Is This Answer Correct ?    37 Yes 6 No

what is virtual function in c++..

Answer / sree

virtual function comes into picture while inheriting the
base class functions to the derived class functions.
ifthe virtual isnot used then the pointer of derived class
points to the baseclass function

Is This Answer Correct ?    28 Yes 1 No

what is virtual function in c++..

Answer / indu

IT'S OVERRIDING A BASE CLASS DEFINITION AT RUN TIME.MEMBER
FUNCTION IN BASE CLASS AND DERIVED CLASS IS SAME. NORMALLY
IT INVOKE THE BASE CLASS DEFINITION IF BOTH FUNCTION NAME
IS SAME.BUT WE NEED TO ACCESS THE DERIVED CLASS DEFINITION
WE GO FOR VIRTUAL FUNCTION

Is This Answer Correct ?    20 Yes 3 No

what is virtual function in c++..

Answer / b.balaganesan

Virtual, as the name implies, is something that exists in
effect but not in reality. The concept of virtual function
is the same as a function, but it does not really exist
although it appears in needed places in a program. The
object-oriented programming language C++ implements the
concept of virtual function as a simple member function,
like all member functions of the class.

Need for Virtual Function:

The vital reason for having a virtual function is to
implement a different functionality in the derived class.

For example: a Make function in a class Vehicle may have to
make a Vehicle with red color. A class called FourWheeler,
derived or inherited from Vehicle, may have to use a blue
background and 4 tires as wheels. For this scenario, the
Make function for FourWheeler should now have a different
functionality from the one at the class called Vehicle.
This concept is called Virtual Function.

Is This Answer Correct ?    10 Yes 3 No

what is virtual function in c++..

Answer / hemin_sdek@yahoo.com

IT'S OVERRIDING A BASE CLASS DEFINITION AT RUN TIME.MEMBER
FUNCTION IN BASE CLASS AND DERIVED CLASS IS SAME. NORMALLY
IT INVOKE THE BASE CLASS DEFINITION IF BOTH FUNCTION NAME
IS SAME.BUT WE NEED TO ACCESS THE DERIVED CLASS DEFINITION
WE GO FOR VIRTUAL FUNCTION

Is This Answer Correct ?    6 Yes 2 No

what is virtual function in c++..

Answer / guest

virtual funtion in cpp is define as globle acess in the
variable.

Is This Answer Correct ?    14 Yes 41 No

Post New Answer

More OOPS Interview Questions

Where You Can Use Interface in your Project

0 Answers   KPIT,


create a c++ program that will accepts 9 inputs using 3 by 3 array.

1 Answers  


Does c++ support multilevel and multiple inheritance?

9 Answers   IBS, Wipro,


What is persistence in oop?

0 Answers  


Explain polymorphism? What r the types of polymorphism? pls give examples?

4 Answers   HCL,


Have you ever interfaced with a database?

2 Answers   IBM,


swapping program does not use third variable

5 Answers   TCS,


Write a program in c++ to read two floating point numbers and find their sum and average.

2 Answers  


what is the virtual function overhead, and what is it used for ? i hope i can get and appropriate answers, thanks a lot....

6 Answers  


what is single inheritance?

18 Answers   IBM,


There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated.

0 Answers  


Definition of Object Oriented Programming in single line?

33 Answers   Impact Systems, Q3 Technologies, TCS,


Categories