In this tutorial I will show you how to create a Number class that can tell you when its value has been actually set, along with other methods to manage how it is used while demonstrating some common object-oriented techniques and features such as operator overloading. You’ll be able to create a Number from an Integer, Double or String.
Tag: Method Overload
Xojo is an Object Oriented Programming Language and, among other things, that means that it supports Methods Overloading. We have seen in other posts that some of these overloaded methods can be Class Constructors, but, there are others things you can do. For example, we can overload the operators. These are the methods in charge of adding two instances of the same class, subtracting, multiplying or dividing them. But we also have at our disposal another operator we can overload: Lookup. What advantages does this give us and how it does it work? Let’s explore it while building a Preferences class we can use in any of our projects.