Q:

Advice with Class Hierarchy for Game Items

I'm writing a MUD engine and I've just started on the game object model, which needs to be extensible.
I need help mainly because what I've done feels messy, but I can't think of a another solution that works better.
I have a class called MudObject, and another class called Container, A container can contain multiple MudObjects, but is a MudObject itself, however MudObjects need to know what they are contained in.
So they look something like this:
public abstract class MudObject
{
    Container containedBy;
}

public abstract class Container : MudObject
{
    List<MudObject> Contains;
}

(please note these are just example and some qualifiers and access modifiers, properties and such are missed off)
Now just this in itself seems messy, but lets add something else to the mix:
Item is a MudObject that all visual items (such as weapons) will be inherited from, however some of these need to be containers too (like chests). But theres no such as multiple inheritance in c#, So it comes down to interfaces, the best choice would be to make the container an interface (as far as I can see) However there was a reason I didn't want it to be, that being that adding an MudObject to a container will cause the container to update the MudObjects .containedBy value.
Any ideas that would make this work, or am I falling into the trap of making things too complicated?
If so what else could you suggest?

A:

I think you are overcomplicating.  If MudObjects can contain other MudObjects, the single base class you need should be along these lines:
public abstract class MudObject
{    
    MudObject containedBy; //technically Parent
    List<MudObject> Contains; //children
}

This is similar to the way WinForms and ASP.NET works.  Many container controls are both controls, and can contain a collection of subcontrols.

A:

What you're asking for is reasonable, and is the Composite Design Pattern

