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 3.3

COLUMN

Implementing Delegates in REALbasic

Issue: 3.3 (January/February 2005)
Author: Charles Yeomans
Author Bio: Charles Yeomans is a software developer in Lexington, Kentucky.
Article Description: No description available.
Article Length (in bytes): 5,770
Starting Page Number: 33
Article Number: 3315
Related Link(s): None

Excerpt of article text...

Objective-C, the main language used in Cocoa, has an interesting mechanism by which objects can delegate implementation of methods to so-called delegate objects. Delegate objects are set at runtime, and may or may not implement all of the methods delegated to them. The delegating object checks to see if the delegate has implemented a particular method. If so, it calls it; if not, it executes some default code.

Unlike Objective-C, REALbasic checks for the existence of methods at compile-time. Thus the usual way to implement a delegation mechanism in REALbasic uses class interfaces. This is fine and quite flexible, but classes implementing a class interface must implement every method of the interface, if only trivially. This means that changes to a class interface affect every class implementing it. So you might think that it's not feasible to have a delegation mechanism in REALbasic like that of Objective-C, but it is, thanks to an obscure addition to REALbasic 5.5.

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