Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualBaneTrapper

Posted 01 November 2012 - 03:42 AM

Assuming that is your exact code, then the primary problem is that you cannot both define and initialize members of a class like that. You have to initialize them in the constructor's initializer list.

The secondary problem, once the above is "solved", is that you should be very careful when you pass this to a member's constructor. The member's constructor is executed before Application's constructor, so the Application object you're passing to the Airplane's constructor is not fully constructed yet. I don't know if it is outright undefined, or simply just undefined to touch the parts that has yet to been initialized so that you can arrange the member carefully to avoid accessing uninitialized parts.

The tertiary problem is (or rather, may be) a design problem: why does the Airplane have to know about the Application?


so the Application object you're passing to the Airplane's constructor is not fully constructed yet

That's why i stated i think its impossible this way.

Well the reason i was trying to pass it this was is the reason i need to call "Airplane::SetAirplane(All the variables);
Example: Am passing pointers to something like "MousePosX" and am thinking a way around from calling a Set function

I decided not to waste too much time here, a whole game needs to be made.
A good day sir's.

#1BaneTrapper

Posted 01 November 2012 - 03:37 AM

Assuming that is your exact code, then the primary problem is that you cannot both define and initialize members of a class like that. You have to initialize them in the constructor's initializer list.

The secondary problem, once the above is "solved", is that you should be very careful when you pass this to a member's constructor. The member's constructor is executed before Application's constructor, so the Application object you're passing to the Airplane's constructor is not fully constructed yet. I don't know if it is outright undefined, or simply just undefined to touch the parts that has yet to been initialized so that you can arrange the member carefully to avoid accessing uninitialized parts.

The tertiary problem is (or rather, may be) a design problem: why does the Airplane have to know about the Application?


Well the reason i was trying to pass it this was is the reason i need to call "Airplane::SetAirplane(All the variables);
Example: Am passing pointers to something like "MousePosX" and am thinking a way around from calling a Set function

PARTNERS