daily pastebin goal
96%
SHARE
TWEET

Untitled

a guest Mar 22nd, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Game2D game = new Game2D();
  14.  
  15.             game.level = new Level2D();
  16.  
  17.             Console.WriteLine(game.level.DummyMethod());
  18.             Console.WriteLine(game.level.MoreDummyMethod());
  19.         }
  20.     }
  21. }
  22.  
  23. abstract class Game<T> where T : Level
  24. {
  25.     public T level;
  26. }
  27.  
  28. class Game2D : Game<Level2D>
  29. {
  30. }
  31.  
  32. abstract class Level
  33. {
  34.     public string DummyMethod()
  35.     {
  36.         return "Level.DummyMethod()";
  37.     }
  38. }
  39.  
  40. class Level2D : Level
  41. {
  42.     public string MoreDummyMethod()
  43.     {
  44.         return "Level2D.MoreDummyMethod()";
  45.     }
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top