Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace JustMyTests
- {
- class Program
- {
- static void Main(string[] args)
- {
- var p = new MyPresenter();
- Presenter ip = p; // error!
- }
- }
- interface IModel
- {
- }
- interface IPresenter<in T>
- where T : class, IModel
- {
- void SomeMethod(T t);
- }
- class Presenter
- {
- }
- abstract class Presenter<T> : Presenter, IPresenter<T>
- where T : class, IModel
- {
- public abstract void SomeMethod(T t);
- }
- class MyModel : IModel
- {
- }
- class MyPresenter : Presenter<MyModel>
- {
- public override void SomeMethod(MyModel t)
- {
- Console.WriteLine("Hello!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement