Hi,
This question is more towards design than towards c++ details.
By looking at books on design patterns and various google threads on
the same topic, I see that composition is favoured to inheritence. One
more article I read was Allen holub's "Why extends is evil".
http://www.javaworld.com/javaworld/j...1-toolbox.html
One general advice I found was that - extending behaviour is better
done with interfaces and composition.
My question is - can we totally get rid of inheritence from concrete
classes ?
Because in all cases we can put common code in a class and use it by
containing an instance to it rather than subclassing it. Also I think
we do subclassing to get a modified behaviour and nothing else. The
only problem I see is few more lines of code. But the advantage is that
even the common code can be replaced at runtime by changing the
instance at runtime.
Is it a good idea if I almost never use subclassing for specializing
the base class, but just to get a interface.
Regards
Preetham