realbasic-betas.mbox
[Top] [All Lists]

Re: Casting Bug

To: REALbasic Betas <realbasic-betas at lists dot realsoftware dot com>
Subject: Re: Casting Bug
From: Noah Desch <noahdesch at erols dot com>
Date: Sun, 27 Oct 2002 18:59:46 -0500

On Sunday, October 27, 2002, at 06:57  PM, Einhugur Software wrote:

The following cast is valid as it should be if GetSomeObject() truly is returning a
object of Type Class1.

 Dim b as Class1
 Dim c as Object

 c = GetSomeObject()

 b = Class1(c)

However if the Code above is put inside of class 1, then suddenly it becomes impossible to cast to the type Class1 (Probably because its looking for a constructor to call instead of casting as it should be doing)

Is there something that I'm missing or is this just a known serious flaw that there is no way to
cast to the type Class1 from within Class1 ??


Yep, that's a known serious flaw. You'll need to define a global method like:

Function CastIntoClass1( C As Object ) As Class1
return Class1( C )
End Function

and call that from with in your code.

RB really needs either a different casting syntax or a different constructor syntax, or both.

-Noah Desch
Wireframe Software
http://wireframe.virtualave.net

"Don't be a cup and ball hog"
-Bart Simpson


---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:realbasic-betas-off at lists dot realsoftware dot com>

Subscribe to the digest:
<mailto:realbasic-betas-digest at lists dot realsoftware dot com>
.


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