I have a Base class and a "child" class named Something which uses private inheritance for reusing generated code.
class Base {
protected:
Base();
public:
virtual ~Base(){}
void cool();
Base& operator=(const Base& other);
};
class Something : private Base {
public:
Something();
void cool(){
// own stuff
// call method from base
Base::cool();
// own stuff
}
Something& operator=(const Something& other){
if (this != &other){
// do own things
And now here, between decoration, should be the call of the operator= from base class.
But I am not sure how I should do this in right way. Should I use
dynamic_cast something like this:
(dynamic_cast (*this)).operator =(dynamic_cast (other));
// do own things
}
return *this;
}
}
Best regards.
No comments:
Post a Comment