realbasic-games
[Top] [All Lists]

Re: Question regarding class / subclass

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: Question regarding class / subclass
From: Robert Steely <robsteely at nc dot rr dot com>
Date: Wed, 23 Jun 2004 17:53:27 -0400
Delivered-to: realbasic-games at lists dot realsoftware dot com
List-help: <mailto:realbasic-games-request@lists.realsoftware.com?subject=help>
List-id: REALbasic Games <realbasic-games.lists.realsoftware.com>
List-post: <mailto:realbasic-games@lists.realsoftware.com>
References: <E7690953-C541-11D8-96A8-000A957887E6 at goodlearning dot com> <D421FE62-C546-11D8-8A86-0003933EA538 at si-co dot com>
On Jun 23, 2004, at 2:55 PM, Frank C wrote:

Can I declare the array to be of type "Object3D" and have it reference various subclasses of Object3D?

Technically that will work, but you may find yourself doing a lot of type casting to get at your subclass data, and that can be expensive if it happens for a lot of objects every frame.

Well, the use of "IsA" occurs at runtime, but the typecasts themselves are only used to override the compiler's type checking at compile time and thus would not impact execution speed. Of course, the code would take longer to enter and would be harder to read because of all the casts. Or am I missing something here? Is "IsA" *that* slow?

Bob

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

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