Defining generic classes with the same name and different number of type arguments

Answered Defining generic classes with the same name and different number of type arguments

  • Monday, August 20, 2012 12:39 PM
     
      Has Code

    In C# one could write something like this:

    public static class Test
    {
    }
    
    public class Test<T>
    {
    }


    How can I do the same in C++/CLI?

    I tried to define:

    public ref class Test abstract sealed
    {
    };
    
    generic<typename T>
    public ref class Test
    {
    };


    But I get a C2011 error: "'class' type redefinition.

    I want to create a static class which defines convenient methods for creating instances of my generic class, just like System.Tuple.

    Any help would be greatly appreciated!

All Replies