Article Preview
Buy Now
| PDF: |
Beginner's Corner
Typecasting
Working with datatypes
Issue: 7.4 (May/June 2009)
Author: Marc Zeedar
editor-at-rbdeveloper.com
Article Description: No description available.
Article Length (in bytes): 10,439
Starting Page Number: 46
RBD Number: 7414
Resource File(s):
7414.zip Updated: Friday, May 1, 2009 at 11:37 AM
Related Link(s): None
Known Limitations: None
Excerpt of article text...
In last issue's Beginner's Corner, I wrote about working with windows. One feature involved building a menu of open windows where I saved the window's reference into a menuitem's tag property. I did this with code that looked like this:
docWindow(wmenu.tag).show
A reader wrote with a question about this and I realized that I probably glossed over an interesting topic. The above code confused the reader because the syntax makes it appear as though I'm passing wmenu.tag as a parameter to docWindow. That's not at all what's happening, but since the syntax is the same as passing parameters to functions, it certainly is confusing. I know when I first ran into this I found it bewildering.
Typecasting
What we are doing here is called typecasting. It's the conversion of data from one type to another. There are two types of typecasting. Most of us are so familiar with the implicit type that we aren't even aware of it. Think about the following code:
dim pi as double = 3.14159265359
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.
|







