473,322 Members | 1,493 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,322 software developers and data experts.

Calling base method within aggregation

Hi,
I am trying to solve one problem. I have one object and I create another different object from it (aggregation).
How can I now call methods of first object within the second object?

Here is how I was trying to do it (its obviously wrong):

class second;
class first
{
public:
second s(this); //here i aggregate the second object
first() {};
void test() {cout<<"test"<<endl;}
};

class second
{
public:
secondc(first *f)
{
f->test(); //and from here I'd like to call the f's method
};
};

void main()
{
first *f = new first();
}


Could you plese provide some hints how this can be done (examples would be great).

thanks & greetings
-oneshed
Sep 1 '07 #1
1 1422
weaknessforcats
9,208 Expert Mod 8TB
The topic is titled Calling Base Method Within Aggregation.

There's no inheritance in your example so there is no base class.

Aggregation means that one object contains other objects not that one object can create other objects. Objects that do that are called Factories.

I guess I'm a little confused as to your question.
Sep 2 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Simon Elliott | last post by:
If I have two classes: class bar { public: void RunTheBar(void); }; class foo {
4
by: Gibby Koldenhof | last post by:
Hiya, I'm setting up some code in the spirit of Design Patterns, OOP, etc. All nice and well, it handles pretty much all OO style things and serves my purposes well. There's one last final...
3
by: J.J. Feminella | last post by:
(Please disregard the previous message; I accidentally sent it before it was completed.) I have source code similar to the following. public class Vehicle { protected string dataV; // ......
5
by: Dave Veeneman | last post by:
I'm using inheritance more than I used to, and I find myself calling a lot of base class methods. I generally call a base method from a dreived class like this: this.MyMethod(); I'm finding...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
8
by: Jackson | last post by:
I want a class that will determine its base class by the argument passed in. What I am about to write _does_not_work_, but it shows what I am trying to do. class ABC(some_super): def...
47
by: Larry Smith | last post by:
I just read a blurb in MSDN under the C++ "ref" keyword which states that: "Under the CLR object model, only public single inheritance is supported". Does this mean that no .NET class can ever...
3
by: Klaus | last post by:
Hi, I have an existing VC 6 MFC application which communicates asynchronly with a VC 2005 managed code dll. I use an unmanaged base class with virtual functions to access methods in the MFC...
7
by: =?ISO-8859-1?Q?Fernando_G=F3mez?= | last post by:
Hello all. I have this class with a virtual method and a constructor that calls this virtual method. A derived class overrides this virtual method, so I expected that when the base's constructor is...
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...
1
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: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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
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.