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

Re: Problems with new covariance

To: REALbasic Betas <realbasic-betas at lists dot realsoftware dot com>
Subject: Re: Problems with new covariance
From: Norman Palardy <palardyn at shaw dot ca>
Date: Fri, 28 Nov 2003 15:42:36 -0700
References: <20031128215244 dot D678C982FB at mail3 dot panix dot com>
On 28-Nov-03, at 2:52 PM, eric at glassbead dot com wrote:

Hi folks,

I've discovered a problem with the new covariance feature.  I implement
a container class with a "get" method that returns a variant. Sometimes
I'll subclass that class and override the "get" method with a method
that returns a specific class type.  This now fails.

To reproduce this:  Create an application with three classes class1,
class2 (which descends from class1) and otherClass. Add a method "get"
to class1 that returns a variant. Override get in class2 to return
otherClass. This now causes the compiler to report an error, but it used
to work just fine.

I thought the notes said that you had to be returning an instance of the root class, a subclass of the root class, or a class that implemented an interface.

This would not be true with a variant as it's not the parent class of any of these.

Maybe I misunderstood the release note ?


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