Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 17.5 ('Numbers')
Instant purchase and download via GumRoad!

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):

Download Icon 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 a blueprint of a house plan, while an instance 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 or design—instances are individual objects based 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.