Created
December 12, 2014 08:12
-
-
Save aiya000/7a903187883eaa7d18d7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /* Java */ | |
| public class Test { | |
| public static void main(String[] args){ | |
| Hoge<Integer> hoge = Hoge.get(10); | |
| System.out.println(hoge.value); | |
| } | |
| } | |
| class Hoge<T> { | |
| private Hoge(){} | |
| public T value; | |
| public static<T> Hoge<T> get(T value){ | |
| Hoge<T> hoge = new Hoge<T>(); | |
| hoge.value = value; | |
| return hoge; | |
| } | |
| } | |
| /* C# */ | |
| // public class Test { | |
| // public static void Main(string[] args){ | |
| // Hoge<int> hoge = Hoge.Get(10); | |
| // Console.WriteLine(hoge.val); | |
| // } | |
| // } | |
| // | |
| // class Hoge<T> { | |
| // private Hoge(){} | |
| // public T val; | |
| // | |
| // public static Hoge<T> Get<T>(T val){ | |
| // Hoge<T> hoge = new Hoge<T>(); | |
| // hoge.val = val; | |
| // return hoge; | |
| // } | |
| // } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment