Re: Asking again: Implementing interface, returning subclass



David Thielen <thielen@xxxxxxxxxxxxx> wrote:
Ok, I tried this a couple of different ways including:
DbConnection IDbConnection.Connection
{
get { return cmd.Connection; }
set { cmd.Connection = (DbConnection) value; }
}

but each gives me a compile error. I looked at the example and it seems the
example is the oppisate of this (I think) where it lets the class act like
the i/f. But I want to turn the i/f into a class that implements it.

What am I not getting?

You need to have two properties - one implementing the interface
explicitly (and returning the interface), and one just declaring the
property, and declaring it to return the concrete type.

--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.



Relevant Pages

  • Re: intel compiler and [REFERENCE] keyword?
    ... would not change by declaring the argument to be a character array as ... of the interface, ... compile, but have a trailing underscore on the exported function. ... the Fortran 2003 features of C interoperability or intrinsic modules. ...
    (comp.lang.fortran)
  • Re: Error signature when calling GetScriptCount of IWMHeaderInfo3
    ... public static extern uint WMCreateEditor( ... public interface IWMMetadataEditor ... public interface IWMHeaderInfo3 ... This is definitely your problem--when declaring COM interfaces ...
    (microsoft.public.windowsmedia.sdk)
  • Re: Error signature when calling GetScriptCount of IWMHeaderInfo3
    ... public static extern uint WMCreateEditor( ... public interface IWMMetadataEditor ... public interface IWMHeaderInfo3 ... This is definitely your problem--when declaring COM interfaces ...
    (microsoft.public.windowsmedia.sdk)
  • Re: avoiding writing an interface blocks
    ... arguments wouldn't require an interface on their own. ... thinking that is part of declaring the type. ... an implicit interface is - not an explicit one. ...
    (comp.lang.fortran)
  • Re: Questions of Designs
    ... This is crude way of declaring complete abstract behavior using language specific syntax. ... What's so different about the C++ ABC above and this Java interface: ...
    (comp.object)

Loading