Hello,
I know that there is no multiple inheritance of classes in C#. My problem is, I have a scenario that I don't know how to solve without it. Are there even scenarios that cannot be solved without multiple inheritance or is it just a flaw in my design
Alright, this is what it's like. Let's say I have a class Object which represents a named item.
class Object { public string Name; }
It's extended by the Person class which adds the age property to it.
class
Person : Object { public int Age; }Next class (IDObject) extends Object, so that it can be associated with an integer.
class IDObject : Object { public int ID; }Now what do I do if I want a person that has an ID Normally, I'd suggest something like:
class
IDPerson : IDObject, Person { }But (apart from being multiple inheritance) that'd get us the good old diamond problem and all the fun stuff. So: How would I handle this situation with normal inheritance
Thanks in advance!