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

Print:
PDF:

Object-Oriented Thinking

Pondering Polymorphism

Issue: 4.2 (November/December 2005)
Author: Charles Yeomans
Article Description: No description available.
Article Length (in bytes): 4,633
Starting Page Number: 33
RBD Number: 4215
Resource File(s): None
Related Web Link(s):

http://www.declareSub.com/

Known Limitations: None

Excerpt of article text...

Polymorphism is perhaps the most elusive of the fundamental concepts of object-oriented programming. Perhaps the reason is that it's often poorly explained. What I think of as the standard mistake of exposition is to explain polymorphism in terms of the ability to override methods in subclasses. This is not polymorphism; this is a way to implement polymorphism. In many previous columns I have demonstrated polymorphism in action. Here I take my crack at putting forth my understanding of polymorphism.

Object Types and Polymorphism

In REALbasic, an object type is a description of what an object can do. In particular, a type specification is a list of the public methods and properties of an object. An object comes with a default type -- the set of all public methods and properties of its class. However, an object can have more than one type.

If the object's class inherits from another class, the object also inherits the associated type of the superclass. Thus an EditField also has types RectControl and Control. Also, all classes other than Object inherit from Object, so every object in REALbasic has type Object.

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