Created
April 27, 2012 08:28
-
-
Save tnngo2/2507425 to your computer and use it in GitHub Desktop.
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; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace Theory8 | |
{ | |
class Customer | |
{ | |
public int Id = 5; | |
} | |
class BaseClass<T> where T:class | |
{ | |
public virtual bool DoSomething(T obj) | |
{ | |
Console.WriteLine("base"); | |
return true; | |
} | |
} | |
class GenericMethod:BaseClass<Customer> | |
{ | |
public override bool DoSomething(Customer obj) | |
{ | |
Console.WriteLine("child => " + obj.Id); | |
return true; | |
} | |
static void Main(string[] args) | |
{ | |
Customer objCus = new Customer(); | |
GenericMethod obj = new GenericMethod(); | |
obj.DoSomething(objCus); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment