Skip to content

Instantly share code, notes, and snippets.

@gbenatti
Created June 1, 2011 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbenatti/1002945 to your computer and use it in GitHub Desktop.
Save gbenatti/1002945 to your computer and use it in GitHub Desktop.
Problemas com herança
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