After you've been programming for a while, you get used to being able to add two numbers together with the "+" operator, subtract them with "-" operator, etc. But when you start creating your own classes, you've found that you can no longer do that, at least from what you know now.
For example, lets say that you have a burrito class, and in this burrito
class you have an This is where operator overloading comes in, which we'll delve into a bit more in the next section. Operator overloading, like classes, has no real equivalent in Pascal. It allows you to "redefine" how certain operators, such as "+" and "-", work when used with your own classes. It is called operator overloading because you are "overloading", or reusing, the same operator with a number of different possible uses, and then the compiler decides how to use that operator depending on what operands it has. |