design patterns - Forcing interface implementations to implement hierarchy in c# -


I am writing an interface for a new project and I would like some advice.

I have a square that is a subclass and has a subclass in this tree of this class like this:

class car {wheels wheel; } Class Wheels {Rims Rim; }

To make it so easy: There is a wheel in a car and one wheel has a rim.

So I would like to emphasize this hierarchy in its interface implementation of ICR, Ivehils and Irim.

So I did something like this (in C #):

  ICW (IWheels Wheel;} IWheels {IRims Rim;}  

And I have an error that I can not have a field in the interface implementation, so it has started me that maybe this is the wrong interface design. I want to emphasize the interface implementation to implement such a hierarchy. Perhaps this is another way to design patterns and prepare the best methods. ?

Can you please tell me how to design my system so that the object is compelled to implement this kind of hierarchy?

Maybe my question is not accurate or I am missing some important information. If so, please ask in comments.

In your interface, you have to specify that the wheels are made of ICR The property should be, because you can not tell which field should be an interface implementation. (The fields are internal workings, so the interface should not be known about it).

  Interface ICAR (IWheels Wheels {get;}}  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -