Article Preview
Buy Now
COLUMN
Shared Properties
Don't be selfish—share your properties
Issue: 17.5 (September/October 2019)
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): 8,062
Starting Page Number: 68
Article Number: 175006
Resource File(s):
project175006.zip Updated: 2019-09-02 11:43:56
Related Web Link(s):
http://docs.xojo.com/UserGuide
Excerpt of article text...
Last issue I talked about computed properties. Today we're going to explore another "advanced" option, shared properties. If you haven't used these before, don't feel bad. That's not unusual as shared properties aren't a common thing. However, in certain circumstances, they are incredibly useful.
A Class Thing
The first thing to understand about shared properties is that they only work as part of a class. You can't just add a shared property anywhere in your project, only to classes.
To work with them you'll need to know the difference between a class and an instance of a class. The metaphor I like to use is to think of a
class as like ablueprint of a house plan, while aninstance is the actual built house.With that thought in mind, you can see how one blueprint can be used to make dozens of houses. The class is the
plan ordesign —instances are individual objectsbased on that plan.It's important to grasp this because shared properties depend on this relationship. Normally, if you add a property to a class, each instance (object) has that property and each can hold a different value.
...End of Excerpt. Please purchase the magazine to read the full article.