KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Will the initialization list always be processed before the constructor code? In other words, will the following code always print <unknown> , and the constructed class will have "known" as value for source_ (if the global variable something is true )? class Foo { std::string source_; public: Foo() : source_("<unknown>") { std::cout << source_ << std::endl; if(something){ source_ = "known"; } } };
Tags (comma-separated)
Save Edits
Cancel