J
Jarmo Muukka
Hello,
I have an interface which has a method which returns an interface. I would
like to return a real type in implemented class.
interface IFoo
{
....
}
interface ISomething
{
IFoo Method();
}
class Foo : IFoo
{
....
}
class Something : ISomething
{
IFoo Method()
{
return new Foo();
}
}
I would like to return Foo as a return type of Method. Is it possible?
Microsoft has done it, but how? They have a SqlDataReader class which
implements IDataReader and they have a SqlCommand which implements
IDbCommand. IDbCommand has a method ExecuteReader which returns IDataReader,
but ExecuteReader of SqlCommand returns SqlDataReader. How did they do this?
JMu
I have an interface which has a method which returns an interface. I would
like to return a real type in implemented class.
interface IFoo
{
....
}
interface ISomething
{
IFoo Method();
}
class Foo : IFoo
{
....
}
class Something : ISomething
{
IFoo Method()
{
return new Foo();
}
}
I would like to return Foo as a return type of Method. Is it possible?
Microsoft has done it, but how? They have a SqlDataReader class which
implements IDataReader and they have a SqlCommand which implements
IDbCommand. IDbCommand has a method ExecuteReader which returns IDataReader,
but ExecuteReader of SqlCommand returns SqlDataReader. How did they do this?
JMu