I think I've been up too long at this stage.. I think this is a really stupid question:
How do I declare all my objects from main() ?
I have an object 'sun' of the class 'CPlanet' and within that class there is an instance of the class 'CAnimation'. But I would like to instantiate everything from main..
So I want to be able to create (or not create) a 'CAnimation' object within 'sun' from main();
You mean remove it from CPlanet? or leave it there and instantiate another instance of it in main(). I assume the purpose of CAnimation is to make the class rotate on its axis, so removing it from CPlanet would not be a very good idea. If you instantiated an instance of CAnimation directly in main() what would it do? What is it supposed to animate ?
Sorry if I didn't explain it clearly..
CPlanet is a generic class that instantiates a mass in space. The mass may or may not be animated. In order for it to be animated there must be an object created within CPlanet that makes animation possible. I do not want this object created each time I make a planet, because some of the planets are just red circles...
So if I have created a CPlanet object called planet, can I then create a CAnimation object called animation within that? And can I do this from main?
Yes, the pointer solution is what I'm looking for. :)
The reason I don't want to use the second approach is because I need to pass a lot of additional parameters to the CAnimate object.. so this would mean I need intermediate functions to transpose those parameters from CPlanet to CAnimate.. this would cause my code to bloat a bit I think..
Thanks a lot for the fast reply and sorry for stupid thread... I've been up for a long time now and my mind was going numb :)