Lecture overview -- Keyboard shortcut: 'u'  Previous page: Overloaded Operators [Section] -- Keyboard shortcut: 'p'  Next page: Overloadable operators in C# -- 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 28 : 45
Object-oriented Programming in C#
Data Access and Operations
Why operator overloading?

Operator overloading is about use of ordinary operatorsl like + and !=, for non-simple types. On this page will motivate you for operator overloading.

Use of operators provides for substantial notational convenience in certain classes

/user/normark/oop-csharp-1/sources/c-sharp/operators/motivation/a.csComparison of operator notation and function notation.

Illustrates that use of operator notation is much briefer than use of method notation - at least when we use natural names of the operations.

/user/normark/oop-csharp-1/sources/c-sharp/operators/motivation/MyInt.csThe class MyInt.

How the methods used above can be be implemented as static methods in the MyInt class.

/user/normark/oop-csharp-1/sources/c-sharp/operators/motivation/outputOutput of comparison between operator and function notation.


Read more about motivation for operator overloading in the text book version of this material.