Article Preview
Buy Now
COLUMN
Column
Issue: 13.3 (May/June 2015)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 12,895
Starting Page Number: 67
Article Number: 13306
Resource File(s):
13306.zip Updated: 2015-05-18 09:57:47
Related Link(s): None
Excerpt of article text...
Last issue I wrote about class extensions as a way to become a Xojo power user. Today I'm going to explore a topic that few talk about, but one that is really powerful. Let's explore custom operators.
Comparing Objects
It's a very common thing to store data as objects. For instance, if you're writing an address book type of program, you might create a
personClass
object with that person's name, address and other details inside it.What often happens when you start with data this way is that eventually you find a need to compare those objects. Is
Object1
the same asObject2
?Xojo isn't very good at telling you this. You might think you can write
if object1 <> object2 then
but that won't do what you want it to do. That's because Xojo compares its internalreference to the object , not the object contents.You can think of the reference as a unique, internal ID. So
Object1
might have an ID of 7 andObject2
might have an ID of 19. To Xojo, they'd be different, even if they contained the exact same data.
...End of Excerpt. Please purchase the magazine to read the full article.