Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Order of member initialization
Re: Order of member initialization [message #58865 is a reply to message #58863] Tue, 20 September 2022 13:29 Go to previous messageGo to previous message
Tom1
Messages: 1212
Registered: March 2007
Senior Contributor
Answering myself: The order of initialization is fixed. Inherited classes get first constructed and only thereafter the local member variables in the order of declaration.

The lesson learnt here is: A base class having member reference variables, referencing variables declared in inherited classes, is a very bad idea. The reference must be initialized when constructing the base class, but the variable cannot be initialized yet at this time. Very bad things happen.

Best regards,

Tom
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Can TheIDE be used in two instances?
Next Topic: Some Questions
Goto Forum:
  


Current Time: Thu May 09 03:53:07 CEST 2024

Total time taken to generate the page: 0.02350 seconds