Defining generic classes with the same name and different number of type arguments
-
Montag, 20. August 2012 12:39
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!
Alle Antworten
-
Montag, 20. August 2012 13:18
Hi Idisis,
it looks the question was answered before: Generic and Non-Generic Class of Same Name in Same Namespace
- Als Antwort vorgeschlagen Jesse JiangMicrosoft Contingent Staff, Moderator Dienstag, 21. August 2012 08:53
- Als Antwort markiert Idisis Montag, 27. August 2012 11:09
-
Montag, 20. August 2012 19:36
Try defining your classes in different pairs of .h and .cpp files. Seems to help.

