Re: Asking again: Implementing interface, returning subclass
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Fri, 7 Apr 2006 21:32:29 +0100
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
.
- References:
- Re: Asking again: Implementing interface, returning subclass
- From: Ignacio Machin \( .NET/ C# MVP \)
- Re: Asking again: Implementing interface, returning subclass
- From: Mike Schilling
- Re: Asking again: Implementing interface, returning subclass
- From: Jon Skeet [C# MVP]
- Re: Asking again: Implementing interface, returning subclass
- Prev by Date: Re: [service] Detecting login / logout / inactive account
- Next by Date: Re: DataGridView ComboBox Binding
- Previous by thread: Re: Asking again: Implementing interface, returning subclass
- Next by thread: Re: Asking again: Implementing interface, returning subclass
- Index(es):
Relevant Pages
|
Loading