Special

Special Print Closeout!

We're clearing out the remainder of our print issues at fire sale prices -- as much as 75% off! Quantities are extremely limited and only available while supplies last. Hurry to take advantage of this one-time offer.

RBD Magazines

Once these printed back issues are gone, they are gone!

Article Preview


Buy Now

PDF:

Object-Oriented Thinking

Wrapper Classes

Issue: 1.2 (October/November 2002)
Author: Charles Yeomans
Article Description: No description available.
Article Length (in bytes): 4,271
Starting Page Number: 36
RBD Number: 1117
Resource File(s): None
Related Web Link(s):

http://www.quantum-meruit.com/RB/

Known Limitations: None

Excerpt of article text...

The wrapper class is a standard trick of object-oriented programming. Apparently, it is so standard that I could not even find a definition of the term on the web. This may be because the notion of a wrapper class has become so general as to defy a precise definition. Nevertheless, its use is often suggested on the REALbasic mailing list to solve various problems, so it's worth a discussion.

Originally, a wrapper class was a class used to encapsulate, or wrap, a non-object thing so as to be able to treat it as an object. A first, obvious, application for RB coders is to wrap OS calls.

Declares can sometimes be tricky to get right. Once you've done so, it is frequently convenient to wrap them in a class for reuse, instead of cutting and pasting. For example, I wrote a wrapper class which reads a Macintosh application's 'SIZE' resource (project available at http://www.quantum-meruit.com/RB/). The class hides the dirty work of reading and parsing the resource inside an object with a simple interface.

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com