नोट
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप साइन इन करने या निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
इस पृष्ठ तक पहुंच के लिए प्राधिकरण की आवश्यकता होती है। आप निर्देशिकाएँ बदलने का प्रयास कर सकते हैं।
'type' : invalid target type for name
Remarks
A casting operator tried to convert to a type that is not a pointer or reference. The dynamic_cast operator can be used only for pointers or references.
Examples
The following example generates C2680:
// C2680.cpp
// compile with: /c
class A { virtual void f(); };
class B : public A {};
void g(B b) {
A a;
a = dynamic_cast<A>(b); // C2680 target not a reference type
a = dynamic_cast<A&>(b); // OK
}
C2680 can also occur when the target is not defined:
// C2680b.cpp
// compile with: /clr /c
// C2680 expected
using namespace System::Collections;
// Delete the following line to resolve.
ref class A; // not defined
// Uncomment the following line to resolve.
// ref class A{};
public ref class B : ArrayList {
property A^ C[int] {
A^ get(int index) {
return dynamic_cast<A^>(this->default::get(index));
}
void set(int index, A^ value) {
this->default::set(index, value);
}
}
};