नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'class' : type-class-id redefined as a formal argument of a function
Remarks
You can't use a generic or template class as a formal argument. You cannot pass an argument directly to the constructor of a generic or template class.
This error is obsolete in Visual Studio 2022 and later versions.
Examples
The following example generates C2942:
// C2942.cpp
// compile with: /c
template<class T>
struct TC {};
void f(int TC<int>) {} // C2942
// OK
struct TC2 {};
void f(TC2 i) {}
C2942 can also occur when using generics:
// C2942b.cpp
// compile with: /clr /c
generic<class T>
ref struct GC {};
void f(int GC<int>) {} // C2942
ref struct GC2 { };
void f(int GC2) {}