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.
Comments closedTag: Constructor
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.
Comments closedA constructor is a special method that is used to initialize a class. They are very handy, but when you use them with control subclasses you have to be aware of how a control’s properties are initialized. Perhaps you’ve run into this situation:
“I have a constructor on my control and the values that I set in the constructor don’t stick.”
Comments closedWouldn’t it be nice to have a TextField with Autocomplete for Xojo Apps, like we are used to in the Xojo IDE? You know, you start to type…
4 Comments