How to pass main object reference to its low level modules in c++
When ever I create my main(Car) object, internally its creates low level modules one by one.
I am referring some function in main object in all internal object
Currently I am passing main object through function(Setter function in all class)
Some how I don't feel its good.could you suggest me some good design.
example:
Code:
car mainobject
grid object mainobject->getFIleName()
vertex oject mainobject->getFIleName()
sub object1 mainobject->getFIleName()
sub object2 mainobject->getFIleName()
triangle object mainobject->getFIleName()
vertex oject mainobject->getFIleName()
sub object1 mainobject->getFIleName()
sub object2 mainobject->getFIleName()
canvas ojbect mainobject->getFIleName()
mesher oject mainobject->getFIleName()
obj1 mainobject->getFIleName()
obj2 mainobject->getFIleName()
obj3 mainobject->getFIleName()
I though of have static class. from static class I will get main object but i need to create multiple instance of car so I cant use static class
Re: How to pass main object reference to its low level modules in c++
If you have multiple instances of that class then passing the correct instance to functions or other objects sounds like a good idea.
Cheers,
_