Visual C++ .NET is smiling to you, please return her smile

The Visual C++ Programming Tutorials: C++ Operator & Function Overloading







C++ You’ve already seen how to construct classes and structs, provide member functions in your types, and use these functions in programs. In this module, you’re going to find out about a special category of member functions called overloaded functions (and overloaded operators), 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++ though the syntax-wise may be similar. In fact, managed C++ types aren’t allowed to implement traditional C++ overloaded operators, so you’ll need to pay close attention to this module to find out how operator overloading is now done. You already met the operators provided by the C++ language before. The problem is that those operators work only with the built-in types, and you’re starting to use classes and structs to define your own data types. This means that if you want to do an addition operation or a comparison operation on types that you’ve created, you can’t use the + and == operators because the compiler doesn’t know how to apply them to your types. Operator overloading is a C++ feature that lets you define operators to work with your types, that is a user defined type which can often lead to a more natural style of programming. Generally, overloaded operators are needed by classes that wrap simple values.

  1. Operator Overloading 1: Intro, What Is Operator Overloading?, What Types Need Overloaded Operators?, What Can You Overload?, Rules of Overloading, Overloading Operators in Managed Types, Overloading Value Types and Overloading Arithmetic Operators

  2. Operator Overloading 2: Operator Overloading in Unmanaged C++ and Overloading Operator Functions

  3. Operator Overloading 3: Implementing Logical Operators and Equality, What Is Equality? and Implementing Equals

  4. Operator Overloading 4: Implementing Assignment

  5. Operator Overloading 5: Implementing Increment and Decrement, Overloading Reference Types, Implementing Overloaded Operators for Reference Types, Calling Overloaded Operators for Reference Types and Guidelines for Providing Overloaded Operators

  6. Operator Overloading 6: The CLS methods: Decimal.op_Addition and Decimal.op_Decrement Methods

  7. Operator Overloading 7: More CLS methods: Decimal.op_Division, Decimal.op_Equality, Decimal.op_GreaterThan Method and Decimal.Parse Method (String, IFormatProvider)

  8. Supplementary Note 1: C++ Operators, Operator Precedence and Associativity - C++ Operator Precedence and Associativity Table, Operator Overloading, Overloadable Operators, Non Overloadable Operators - Example and Overloaded Operators

  9. Supplementary Note 2: General Rules for Operator Overloading - Example, Implicit Boxing - Example, Explicitly Request Boxing, Use gcnew to Create Value Types and Use Implicit Boxing, Unboxing, Standard Conversions and Implicit Boxing, static Keyword and Static Member Functions




Best viewed using FireFox, Chrome etc. Worst viewed using IE of any version


Webmaster contact: [contact[@]]

Copyright 2019 © Visualcplusdotnet. All rights reserved.

Excellent hosting services provided by MochaHost - The Online Central



| About | Disclaimer | Privacy | Site Index & Project Download | Native C | Contact |



Custom Search