HighTechTalks DotNet Forums  

Accessing base class method using derived class object

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss Accessing base class method using derived class object in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
srini4vasan@gmail.com
 
Posts: n/a

Default Accessing base class method using derived class object - 07-26-2007 , 08:04 AM






#include<iostream>
using namespace std;

class A
{
public:
void display()
{
cout<<"A display"<<endl;
}

};

class B : public A
{
public:
void display()
{
cout<<" B display "<<endl;
}
};

int main()
{
B b1;
b1.display();

return 0;
}

In this program can you please tell me how can i access base class
method ie.,display() using derived class object.ie.,b1.

A single line has to be included in this main funtion.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.