Chapter 10: Operator Overloading

Download CD Content


In this chapter, you will learn how to:

  • What operator overloading is

  • Which classes should support operator overloading

  • What you can and can’t overload

  • Guidelines for providing overloaded operators

  • How to implement operator overloads

You’ve already seen how to construct classes and structs, provide member functions in your types, and use these functions in programs. In this chapter, you’re going to find out about a special category of member functions called overloaded operator functions, which allow you to add extra functionality so that your types can be used more naturally and intuitively.


If you’ve met operator overloading in C++ before, you need to be aware that overloading is handled completely differently in managed C++ than in traditional C+. In fact, managed C++ types aren’t allowed to implement traditional C++ overloaded operators, so you’ll need to pay close attention to this chapter to find out how operator overloading is now done.

Microsoft Visual C++  .NET(c) Step by Step
Microsoft Visual C++ .NET(c) Step by Step
ISBN: 735615675
Year: 2003
Pages: 208 © 2008-2017.
If you may any questions please contact us: