Let's imagine you are making a game.
You want some objects to be breakable by hand, so you will have interface
IBreakable.
Let's say you also have iWood for objects from wood, iStorage for objects
that can be used to store items, etc.

Now how to make a case, which can be destructible, you can store items in
and is from wood?

class MyCase : IBreakable, iWood, iStorage
{
...
}

2010/11/13 It's time to do something <[email protected]>

> Hi, can anyone here give me some ideas on how important interface is
> (in C#) and what it can do?
> I've learned that it can  be used as polymorphism, but I don't
> understand why in some cases we don't use polymorphism instead ? And
> when do we use interface ? When do we use polymorphism  instead ?
> Thank you so much ! I'm just a newbie at all. Hope someone will help
> me !

Reply via email to