realbasic-nug
[Top] [All Lists]

Re: Subclassing Question

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Subclassing Question
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Thu, 22 Aug 2002 07:38:44 -0700
At 7:16 AM -0700 8/22/02, Will Leshner wrote:

Requiring an override of NewObject is very elegant and is exactly the way you should do things. Especially it is very inelegant to have a super class know about its subclasses. Otherwise you'd have to change your super class every time you or somebody else creates a new subclass. You probably should make a super class that returns NIL for NewObject. That way if somebody forgets to override they will find out pretty quickly.

Good idea -- even better would be for the superclass to post a message box that says "Hey, somebody forgot to override NewObject!"

Of course this won't work if you have a class hierarchy more than 1 deep.

Cheers,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'


<Prev in Thread] Current Thread [Next in Thread>