Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

PDF:

Feature

Advanced Techniques

Object Oriented Programming in REALbasic

Issue: 1.3 (December/January 2002)
Author: Thomas Reed
Author Bio: Thomas Reed has been programming as a hobbyist for more than 20 years, and fell in love with the Mac in 1984.
Article Description: No description available.
Article Length (in bytes): 11,056
Starting Page Number: 30
RBD Number: 1315
Resource File(s):

Download Icon 1315.sit Updated: Friday, October 17, 2003 at 12:20 PM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

When you work in REALbasic, there is no escaping from object-oriented programming (OOP). Everything you do centers around objects -- windows, controls, and even your own custom classes. Nonetheless, there is much more lurking under the surface of REALbasic's classes than is immediately evident. This column will look at several facets of OOP like class inheritance, method overloading, and class interfaces.

Inheritance

One of the most important concepts in any object-oriented approach is inheritance. Inheritance allows you to create new classes that are based on existing classes, thus allowing you to reuse existing code. For example, suppose you are writing a simulator program in which you create a Vehicle class, which includes information about velocity, among other things. If you want to add a Car class to the simulator, it is easy to create Car as a subclass of Vehicle. The new class inherits all properties and methods of the super (or parent) class, and can also define its own properties and methods. For example, your Car class should have methods for dealing with movement provided by the Vehicle parent class, and might extend that by adding methods for trunk capacity, engine type, sunroof, and number of doors.

...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