Article Preview
Buy Now
COLUMN
Knowing Scope
What's the difference between public, private, and protected?
Issue: 16.1 (January/February 2018)
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: n>No description availabl
Article Length (in bytes): 17,361
Starting Page Number: r>
Article Number: 16106
Resource File(s):
project16106.zip Updated: 2018-01-01 22:32:33
Related Link(s): None
Excerpt of article text...
Recently I got an email from an
xDev reader wanting advice aboutscope . Scope is one of those tricky things that's powerful and useful, but can be confusing.To learn about scope, let's first imagine a situation where scope didn't exist. Scope is basically about when an object or a variable is within a range or not. For instance, if I have a method where I define the variable
i
:
dim i as integer
I know that
i
exists within that method. If I go to a different method,i
does not exist. If it did, coding in Xojo would be extremely confusing. I'd try to redefinei
in that second method and Xojo would give me an error saying thati
has already been defined. Basically, without scope, every variable and object would beglobal .
...End of Excerpt. Please purchase the magazine to read the full article.