Advertisement
Guest User

Untitled

a guest
Sep 20th, 2011
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.77 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace SomeSuspeciousAssembly
  5. {
  6.     class SomeSuspeciousClass
  7.     {
  8.         //Some junk malicious code
  9.     }
  10.  
  11. }
  12.  
  13. namespace ConsoleApplication1
  14. {
  15.     abstract class MyBase<T> where T : MyBase<T>
  16.     {
  17.         public void MyMethod()
  18.         {
  19.             Console.WriteLine("MyMethod");
  20.         }
  21.     }
  22.  
  23.     class MyDerived : MyBase<MyDerived>
  24.     {
  25.  
  26.     }
  27.  
  28.     class MyOtherDerived :
  29.         MyBase<SomeSuspeciousAssembly.SomeSuspeciousClass>//Gives error. Should not be done.
  30.     {
  31.  
  32.     }
  33.  
  34.    
  35.     class Program
  36.     {        
  37.         static void Main(string[] args)
  38.         {
  39.             MyBase<MyDerived> obj = new MyDerived();
  40.             obj.MyMethod();
  41.             Console.ReadLine();
  42.         }        
  43.     }
  44.      
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement