Visual Studio 2010 - Visual C++
Compiler Error C3182
'class' : a member using-declaration or access declaration is illegal within a managed type
A using declaration is invalid within all forms of managed classes.
The following sample generates C3182.
// C3182a.cpp
// compile with: /clr /c
ref struct B {
void mf(int) {
}
};
ref struct D : B {
using B::mf; // C3182, delete to resolve
void mf(char) {
}
};
The following sample generates C3182.
// C3182b.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
__gc struct B {
void mf(int)
{
}
};
__gc struct D : B {
using B::mf; // C3182, delete to resolve
void mf(char)
{
}
};
int main()
{
}
Community Content
SmallSky
What I can do instead using?
Hello everyone. I've faced with following trouble:
public __gc class A : public IA
{
protected: virtual void A1(bool){}
public: void A1();
private: ~A();
public: A(){}
};
public __gc class B : public A
{
private: void A1(bool){/*do something*/;}
};
...
void foo()
{
B b=new B();
b->A1(); //error: compiler doesn't see b::A1() and write about "b::A1(bool) missed args"
}
I wanted resolve this with "using A::A1()" in class B, but have got this (C3182) error message. What I can do instead?
I temporarily resolved this situation with redefinition A::A1() in class B:
public __gc class B : public A
{
public: void A1() { __super::A1(); }
private: void A1(bool){/*do something*/;}
};
Any other ideas?
public __gc class A : public IA
{
protected: virtual void A1(bool){}
public: void A1();
private: ~A();
public: A(){}
};
public __gc class B : public A
{
private: void A1(bool){/*do something*/;}
};
...
void foo()
{
B b=new B();
b->A1(); //error: compiler doesn't see b::A1() and write about "b::A1(bool) missed args"
}
I wanted resolve this with "using A::A1()" in class B, but have got this (C3182) error message. What I can do instead?
I temporarily resolved this situation with redefinition A::A1() in class B:
public __gc class B : public A
{
public: void A1() { __super::A1(); }
private: void A1(bool){/*do something*/;}
};
Any other ideas?