GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Aalayance Inc  >  Placement Papers
Go To First  |  Previous Question  |  
 Placement Papers  |  Question 4 of 4    Print  
Virtual Method
Base class has some virtual method and derived class has a method with the same name. if we initialize the base class pointer with derived object, calling of that virtual method will result in which method being called?




  
Total Answers and Comments: 2 Last Update: November 25, 2008     Asked by: chhavi1440 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
November 12, 2008 09:25:08   #1  
zeal_goswami Member Since: November 2008   Contribution: 1    

RE: Virtual Method
base class method
 
Is this answer useful? Yes | No
November 25, 2008 09:33:47   #2  
hydsarema Member Since: August 2008   Contribution: 11    

RE: Virtual Method

derived function is called
to demonstrate this is the foll program


#include<iostream.h>
#include<conio.h>

class base
{
public: virtual void vfun()
{
cout<<"this is base virtual function calling";
}
};

class derived1:public base
{
public:void vfun()
{
cout<<"this is derived function calling";
}
};


void main()
{
clrscr();

base *p b;//base class pointer is created

derived1 ob1;

p &ob1;//initialise base class pointer with derived class

p->vfun();//derived function is called

getch();
}
/* output
this is derived function calling*/


 
Is this answer useful? Yes | No

 Related Questions

Base class has some virtual method and derived class has a method with the same name. if we initialize the base class pointer with derived object, calling of that virtual method will result in which method 
Latest Answer : derived function is calledto demonstrate  this is the foll program#include#includeclass base  {     public: virtual void vfun()      {        ...


 Sponsored Links

 
Related Articles

Online Virtual Business Network

How to begin an Online Virtual Business Network What is Virtual Business Network Business and commerce right from the ancient days depended a lot on the physical representation of the business and the physical identity of the customers and other collaborators Most of the business dealings were done
 

Agility in Virtual Business Networks

Agility in Virtual Business Networks Agility means responding to rapid changes and continuous change management With the rapid economic changes and unexpected market behavior the virtual business networks have to adapt themselves to be able to respond in a timely and fast manner Therefore agility pr
 

Creating Virtual Business Network

Requirements of Virtual Business Network The sudden expansion of electronic commerce has resulted in many changes in the way business is done globally The virtual business network is the buzz word among the business communities internet community and freelance work seekers Traditional business strat
 

Business Network Virtual Communication Tools

Business Network Virtual Communication Tools Since ages the Business community heavily relied on face to face communication for building Business relationships Face to face communications formed the basis for trust in a relationship An individual&rsquo; s appearance or the physical appearance of
 

Virtual Business Networks

Virtual Business Networks Classification of Virtual Business Networks Virtual Business Network is the most discussed topic among the Business Communities nowadays The basic definition of a Virtual Business Network means a group of small Businesses joining together to collaborate and co operate to ac
 

Collaboration in Virtual Business Networks

Collaboration in Virtual Business Networks Most common businesses are small and majority of them are home based businesses The small businesses have different common fields ranging from the traditional consumer business to technological trading Mostly these small businesses have been responsible for
 

C++ Pure Virtual Function and Base Class

C Pure Virtual Function and Virtual Base Class In this C tutorial you will learn about pure virtual function declaration of pure virtual function and virtual base class virtual base class and how to implement a virtual base class explained with examples mosgoogle center What is Pure Virtual Function
 

C++ Virtual Functions

C Virtual Functions What are Virtual Functions 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 la
 

What is Common Data Modeling Method

Common Data Modeling is one of the core considerations when setting up a business data warehouse. Any serious company wanting to have a data warehouse will have to be first serious about data models. Building a data model takes time and it is not unusual for companies to spend two to five years just
 

JavaScript Window Object Open Method Part 2

JavaScript Window Object Open Method Part 2 In this JavaScript tutorial you will learn about JavaScript Window Object Open Method features of window object open method scrollbars status titlebar toolbar top width innerHeight innerWidth outerHeight outerWidth and hotkeys mosgoogle center scrollbars S
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape