Interface for method that returns its own type

Posted by Andrey on Stack Overflow See other posts from Stack Overflow or by Andrey
Published on 2010-06-15T13:39:44Z Indexed on 2010/06/15 13:42 UTC
Read the original article Hit count: 180

Filed under:
|
|

I have a situation where i have a class

class Foo
{
    Foo Bar()
    {
        return new Foo();
    }
}

Now i wan tot create an interface for it

class IFoo
{
    ??? Bar();
}

What should be in place of the question marks? Each class should return it's own type, not Foo

© Stack Overflow or respective owner

Related posts about c#

Related posts about inheritance