Lecture overview -- Keyboard shortcut: 'u'  Previous page: Overloadable operators in C# -- Keyboard shortcut: 'p'  Next page: Some details of operator overloading -- 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 4 : 20
Object-oriented Programming in C#
Operators, Delegates, and Events
An example of overloaded operators: Interval

We introduce a new type, struct Interval, in which we implement a number of operations by overloads of some of the well-known C# operators.

An interval is a type that represents the ordered sequence of integers between one integer and another

We program the type Interval with value semantics

/user/normark/oop-csharp-1/sources/c-sharp/interval/witoutdoc/Interval-without-indexer.csThe struct Interval. This program is explained

This type defines a number of overloaded operators in struct Interval.

/user/normark/oop-csharp-1/sources/c-sharp/interval/witoutdoc/app.csA client program of struct Interval. This program is explained

This class uses the operators on given interval values.

/user/normark/oop-csharp-1/sources/c-sharp/interval/witoutdoc/outputOutput from the interval application.

Go to exerciseInterval indexer
Go to exerciseAn interval overlap operation
/user/normark/oop-csharp-1/sources/c-sharp/playing-card/playing-card-operators/PlayingCard.csThe class PlayingCard with relational operators.

The operators ==, !=, <, and > in class Card.

Read more about the interval and playing card examples in the text book version of this material.