KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In C++, I want to define an object as a member of a class like this: Object myObject; However doing this will try to call it's parameterless constructor, which doesn't exist. However I need the constructor to be called after the containing class has done some initialising. Something like this. class Program { public: Object myObject; //Should not try to call the constructor or do any initializing Program() { ... //Now call the constructor myObject = Object(...); } }
Tags (comma-separated)
Save Edits
Cancel