May 03, 2024, 08:26:18 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


OOP question

Started by srod, July 29, 2007, 06:45:17 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

srod

July 29, 2007, 06:45:17 AM Last Edit: July 29, 2007, 07:08:27 AM by srod
Hi,

just experimenting with OOP here (OOP newbie alert  ;D !!) and am wondering if anyone can supply me with a quick example of a 'class within a class' ?

I am able to set up a pointer to a class variable easy enough and then invoke methods of the class; no problem.

What I am unable to do, however, is set up a second class having a pointer as one of its public members, set up instances of the two classes, set the pointer in the second class variable to point at the first class variable and then invoke methods of the first class through this pointer. The only way I can get this to work is to use a temporary pointer etc. which I can't help but feel should be redundant!

I can post my errant code if this would help anyone get to the root of my problem!

Thanks in advance.

Stephen.

pistol350

Yep!
I think it is wiser to post a piece of code.

Regards!
Regards,

Peter B.

srod

Quote from: pistol350 on July 31, 2007, 07:49:27 AM
Yep!
I think it is wiser to post a piece of code.

Regards!

Sorry, I have it all working now but do have to use a temporary pointer variable - even with the c-style pointers.