T
toton
Hi,
I want a few of my class to overload from a base class, where the
base class contains common functionality. This is to avoid repetition
of code, and may be reducing amount of code in binary, not to get
polymorphic behavior.
None of them has virtual methods, and are self contained (no
destructor at all) thus do not have a chance to have memory error.
Thus the derived classes has additional functionality, not additional
data.
Now, will the derived class suffers any performance penalty, if I
compare it to a single class which contains all of the functionality.
Second, if I want to suppress some of the functionality, is it ok to
have a private inheritance and forwarding the functionality which I
need from base class ?
Or delegation is a better way ( which adds one extra level of
indirection) ?
some of such inheritance are actually from stl container classes, like
deque and other, where I need to give a range support (like
boost::sub_range ) with a get_range method,
or want to remove some functionality like erase, assign, push_front and
pop_back.
Thanks
abir
I want a few of my class to overload from a base class, where the
base class contains common functionality. This is to avoid repetition
of code, and may be reducing amount of code in binary, not to get
polymorphic behavior.
None of them has virtual methods, and are self contained (no
destructor at all) thus do not have a chance to have memory error.
Thus the derived classes has additional functionality, not additional
data.
Now, will the derived class suffers any performance penalty, if I
compare it to a single class which contains all of the functionality.
Second, if I want to suppress some of the functionality, is it ok to
have a private inheritance and forwarding the functionality which I
need from base class ?
Or delegation is a better way ( which adds one extra level of
indirection) ?
some of such inheritance are actually from stl container classes, like
deque and other, where I need to give a range support (like
boost::sub_range ) with a get_range method,
or want to remove some functionality like erase, assign, push_front and
pop_back.
Thanks
abir