how to use Class with Other Classes as Member Data

Pages: 12
The last assumption is 100% correct. t2 is kind of a processor using lots of t1 as coprocessors, in response to external "commands" passed to an t2 object through its member functions. Unfortunately t2 must be initialized, and t1's, not with the empty constructor.

Regarding the overloading, I must admit I know very little about overloading operators, and I will not bug you with something available in the books. I'm not quite sure it will shorten the code or the memory required, but I must chew on it for a while.

About pointers, that is a totally different subject. Unfortunately C does not have a type of data called pointer, so a certain variable to keep an address, and to point to an int, after that to a long long, etc. That would shorten the code considerably, and wold make many overloaded functions useless. Pointers in C are bind with the type they point initially to, they seem to me like aliases more than real pointers. So it will be a variable variable of only one type.... quite limitative. To implement variable variables in C would be easy on the other hand, but I do not have time to do it myself. Too bad than no one did it before, for the rest of us to use it :)

Thanks for the answer, I'll start digging on overloading operators in a sec.
Operator overloading tutorial: http://www.cplusplus.com/doc/tutorial/classes2/

You can use C++'s library containers to have multiple instances of t1: http://www.cplusplus.com/reference/stl/
Pointers in C are bind with the type they point initially to, they seem to me like aliases more than real pointers.
If you need pointing to different classes all derived from a common base you can use polymorphism
Topic archived. No new replies allowed.
Pages: 12