Lecture overview -- Keyboard shortcut: 'u'  Previous page: Interfaces in C# -- Keyboard shortcut: 'p'  Next page: Interfaces from the C# Libraries -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Help page about these notes  Alphabetic index  Course home  Page 13 : 37
Object-oriented Programming in C#
Abstract classes, Interfaces, and Patterns
Examples of Interfaces

Two or more unrelated classes can be used together if they implement the same interface

/user/normark/oop-csharp-1/sources/c-sharp/interfaces/playingcard-die/gameobject.csThe interface IGameObject.


/user/normark/oop-csharp-1/sources/c-sharp/interfaces/playingcard-die/die.csThe class Die which implements IGameObject.


/user/normark/oop-csharp-1/sources/c-sharp/interfaces/playingcard-die/PlayingCard.csThe class Card which implements IGameObject.


/user/normark/oop-csharp-1/sources/c-sharp/interfaces/playingcard-die/client.csA sample Client program of Die and Card.


/user/normark/oop-csharp-1/sources/c-sharp/interfaces/playingcard-die/outputOutput from the sample Client program of Die and Card.


In the example above, the GameObject could as well have been implemented as an abstract superclass

Go to exerciseAn abstract GameObject class