Operator overloading is a powerful tool that allows you to redefine many operators (addition, subtraction, and so on) within classes and structures, making them more useful and relevant to the class or structure in question. With the release of Microsoft Visual Studio 2005, you can now create and use overloaded operators in your code. The use of operator overloading allows for much cleaner, readable code, and additionally makes it much easier to interact with some types in the .NET Framework that already expose overloaded operators (for example, System.Data.SqlTypes or DateTime). This article discusses the scenarios in which operating overloading can be a very useful tool for you when you write applications using Visual Basic. It shows examples of how you can introduce operator overloading into your classes and structures in such a way as to make those objects act in statements as if they were intrinsic types (such as String, Integer, and so on).
|