M
mati-006
Hi
Suppose we have classes A,B and C, and A must call some member f-ns of
B, B calls something from C and C something of A.
There is some object that contains A a; B b; and C c;
Objects a, b and c has pointers (in object "a" I've got a pointer to
"b", and so on), and everything is fine.
Question is - how to initialize such pointers. I can't do it in
constructor (maybe I could if simulatenous initialization of these three
objects would be possible ;-), I could initialize these objects and then
call some get_pointer() functions that will finish the initialization,
but this approach seems "ugly" to me (and could get messy when program
is getting more complicated). Is there a good and proper OOP approach to
this?
Suppose we have classes A,B and C, and A must call some member f-ns of
B, B calls something from C and C something of A.
There is some object that contains A a; B b; and C c;
Objects a, b and c has pointers (in object "a" I've got a pointer to
"b", and so on), and everything is fine.
Question is - how to initialize such pointers. I can't do it in
constructor (maybe I could if simulatenous initialization of these three
objects would be possible ;-), I could initialize these objects and then
call some get_pointer() functions that will finish the initialization,
but this approach seems "ugly" to me (and could get messy when program
is getting more complicated). Is there a good and proper OOP approach to
this?