KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
As far as I know it is not possible to call the constructor of the base class. The only way I know is this: MyClass::MyClass(/* args */) : Base(/* args */) { // ... } but this would invoke the constructor at the beginning. Is there any way to call it somewhere else in the constructor? Something like this: MyClass::MyClass(/* args */) { // ... instructions Base::Base(/* args */); // ... other_instructions } According to this What are the rules for calling the superclass constructor? question I understand there is no way but I read here and I guessed it was possible, but if I try I get: error: invalid use of 'class Base'. Am I doing something wrong? Is it possible to do this some way or is there any other possible solution to this need? Thanks! EDIT: I understand I forgot a key point: the base class is part of a framework, and therefore it would be good not to have to modify it, if possible.
Tags (comma-separated)
Save Edits
Cancel