I have a class which is derived from a data container class. The constructor is not able to initialize all of the contents of the container, so it is necessary to call another class member function (providing some additional data) to finish off initialization. This member function sets a boolean to true, stating that data is ready for access.
If the data was a member of the class, I'd set it private/protected and I'd have an accessor such as:
mycontainer& get_data() { check_macro(ready, "Data not ready"); return data; }
How do I do this if the class is inherited from mycontainer
? Can I derive it from mycontainer
privately and then expect that returning a reference to this
will be public?