Ejemplo n.º 1
0
    static void Main()
    {
        // Create a Gen2 object for string and int.
        Gen2 <string, int> x = new Gen2 <string, int>("Value is: ", 99);

        Console.Write(x.GetOb());
        Console.WriteLine(x.GetObj2());
    }
Ejemplo n.º 2
0
    static void Main()
    {
        // Create a Gen object for int.
        Gen <int> iOb = new Gen <int>(88);

        // This calls Gen’s version of GetOb().
        Console.WriteLine(iOb.GetOb());

        // Now, create a Gen2 object and assign its
        // reference to iOb (which is a Gen<int> variable).
        iOb = new Gen2 <int>(99);

        // This calls Gen2’s version of GetOb().
        Console.WriteLine(iOb.GetOb());
    }
Ejemplo n.º 3
0
    static void Main()
    {
        Gen2 <string> g2 = new Gen2 <string>("Hello");

        Console.WriteLine(g2.GetOb());
    }