473,326 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Inheritence question

Hi Group,

Here's the scenario:

I have a class A with a virtual method X()
I have a class B :deriving from A with an override method X()
I have a class C deriving from B

From an object of class C, I'd like to access the X method on class A. How
do I achieve something like this?

thanks,
Ron
Aug 8 '06 #1
2 826
"Ron M. Newman" <co**********@confideltial.coma écrit dans le message de
news: ud**************@TK2MSFTNGP02.phx.gbl...

| I have a class A with a virtual method X()
| I have a class B :deriving from A with an override method X()
| I have a class C deriving from B
|
| From an object of class C, I'd like to access the X method on class A. How
| do I achieve something like this?

You don't ! If you have to do this, then your design is wrong :-(

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Aug 8 '06 #2
actually, you're right. I've changed my design.

assembly 1:

class A - raw methods
class B - regulated methods, "internal" scope ones to go raw, regulated
ones go to raw after a check and possible exception

assembly 2:

class C - all calls are referred to regulated methods on class B

thanks !

"Joanna Carter [TeamB]" <jo****@not.for.spamwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
"Ron M. Newman" <co**********@confideltial.coma écrit dans le message de
news: ud**************@TK2MSFTNGP02.phx.gbl...

| I have a class A with a virtual method X()
| I have a class B :deriving from A with an override method X()
| I have a class C deriving from B
|
| From an object of class C, I'd like to access the X method on class A.
How
| do I achieve something like this?

You don't ! If you have to do this, then your design is wrong :-(

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer


Aug 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John | last post by:
Hi, I am trying to create a class heirarchy similar to the following: // base interface class ICar { public: virtual void start() = 0; }; // add members to that interface, but retain base...
8
by: Digital Puer | last post by:
I made the following table to help me (re)learn inheritence basics. Can someone check if it's correct? This table requires a courier-like font. Java C++ ---- ...
5
by: john bailo | last post by:
For a c# web application, I created a user control that includes a form in control. The idea is, on the main Page, when the user clicks Submit from the master form, that makes the user control...
10
by: Malay Haldar | last post by:
I have a function object, from which I derive another function object in which I overwrite the operator(). But now the operator() in the base class seems inaccessible. For example, the following...
7
by: preetam | last post by:
Hi, This question is more towards design than towards c++ details. By looking at books on design patterns and various google threads on the same topic, I see that composition is favoured to...
7
by: Ron Vecchi | last post by:
Latley I have been messing around with polymorphsim and inheritence and really enjoying the benefits. public myclass() { 'mycode } public myclass(string s) : this() { 'more code
5
by: Neelesh Bodas | last post by:
This might be slightly off-topic. Many books on C++ consider multiple inheritence as an "advanced" concept. Bruce Eckel says in TICPP, volume 2 that "there was (and still is) a lot of...
0
by: tirumalab | last post by:
Hi all, im working on C#, in my current proj we're using one form as the base form and deriving it from all the forms ,its working fine with windows applicatons.But we want to develop the same...
6
by: CapMaster | last post by:
I'm having some trouble using Inheritence classes in c++. I have my base class (Time.h) and my derived class is called (MilTime.h). I started writing my MilTime.cpp for the function definitions. Now,...
4
by: arnaudk | last post by:
I have two unrelated types of data elements (objects) which I want to hold in two related types of containers, one for each element type. But this seems contradictory - for consistency, it seems that...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.