Chapter 19: Operator Overloading


Chapter 19

Operator Overloading

After completing this chapter, you will be able to:

  • Implement binary operators for your own types.

  • Implement unary operators for your own types.

  • Write increment and decrement operators for your own types.

  • Understand the need to implement some operators as pairs.

  • Implement implicit conversion operators for your own types.

  • Implement explicit conversion operators for your own types.

You have made a great deal of use of the standard operator symbols (such as + and –) to perform standard operations (such as addition and subtraction) on types (such as int and double). Many of the built-in types come with their own predefined behaviors for each operator. You can also define operators for your own structs and classes, which is the subject of this chapter.




Microsoft Visual C# 2005 Step by Step
Microsoft® Visual C#® 2005 Step by Step (Step By Step (Microsoft))
ISBN: B002CKYPPM
EAN: N/A
Year: 2005
Pages: 183
Authors: John Sharp

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net