www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - using typedefed types as covariant return types

I was hoping I could do this:

typedef void* CFTypeRef;
typedef CFTypeRef CFStringRef;

class DCFObject
{
  CFTypeRef getRef() {}
}

class DString : DCFObject
{
  CFStringRef getRef() {}
}

But the compiler gives me:

src/d/darbon/corefoundation/DString.d:32: function
darbon.corefoundation.DString.DString.getRef of type CFStringRef() overrides
but is not covariant with darbon.corefoundation.DCFObject.DCFObject.getRef of
type CFTypeRef()

From what I gather in the docs, CFStringRef is derived from CFTypeRef, so this
should be acceptable. Am I missing something?

TIA,
Rick
Feb 04 2007