On Sep 20, 5:35?pm, Suraj <surajprakash...@gmail.com> wrote:
hello,
I need to develop a mechanism to selectively inherit member
variables and functions from Base into Derived.
class Base {int a;};
class A: public Base {int b;};
class B: public C {int c;};
class D: public D {int d;};
...
class Derived-X: public X; //include all members til class X
I also posed myself this problem when I learned C++ and it IS the
C++ problem. Most classes show the same concern as to reduce size
for it and its possible derivations. Some solutions can be quite
complex and are not worth the while when you consider pointers vs
architecture complexity. I think that was the reason for virtual
inheritance and templates to make it into the language... but it
only makes sense for functionality bundles, not to bundle together
data types, for this last case it is much better to make as many
structs suitably named as data type combinations are relevant...
on them to keep the invariant. As such, it makes little sense to