in reply to a question on namespaces and inheritance
When you inherit Foo from Bar you say that "Foo IS-A Bar" (parrot IS-A bird). So your ChildClass1 IS-A MotherClass and ChildClass2 also IS-A MotherClass.
Now, you say that ChildClass1 and ChildClass2 have some common functionality - and you want to express it by inheriting ChildClass2 from ChildClass1, that is, to say that ChildClass2 IS-A ChildClass1. How about just exporting the common functionality into another class and use multiple-inheritance, if there are really good reasons not to just inherit Child2 from Child1 ?
You're giving an abstract example and it's difficult to help much. Perhaps you can provide us with the real problem at hand ? You may get more specific answers then.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: a question on namespaces and inheritance
by thcsoft (Monk) on Jun 03, 2005 at 11:43 UTC |