Created
June 1, 2011 18:27
-
-
Save gbenatti/1002945 to your computer and use it in GitHub Desktop.
Problemas com herança
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace heir | |
{ | |
interface IBasicController | |
{ | |
} | |
interface ILoadController : IBasicController | |
{ | |
} | |
class LoadPresenter : BasePresenter<ILoadController> | |
{ | |
} | |
interface IPresenter<out T> | |
{ | |
void Hell(); | |
} | |
class BasePresenter<T> : IPresenter<T> where T : IBasicController | |
{ | |
public void Hell() | |
{ | |
Console.WriteLine ("Hell: " + typeof(T)); | |
} | |
} | |
class Use | |
{ | |
IPresenter<IBasicController> _foo; | |
public void Go<T>(IPresenter<T> foo) where T : IBasicController | |
{ | |
_foo = foo; | |
_foo.Hell(); | |
} | |
} | |
class MainClass | |
{ | |
public static void Main (string[] args) | |
{ | |
new Use().Go<ILoadController>(new LoadPresenter()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment