cli类方法参数 [英] cli class method parameters
本文介绍了cli类方法参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有类似的东西:
If I have something that resembles:
public ref class ManagedFoo sealed
{
void method(ManagedFoo^& mfoo,ManagedGoo^& mgoo)
{
//...//
}
}
public ref class ManagedGoo sealed
{
//...//
}
它给了我错误
it gives me error
Error 4 error C2061: syntax error : identifier 'ManagedGoo' path 55 1 ...
谁知道为什么?
anyone knows why is that ?
推荐答案
C ++要求您在使用它们之前知道类型.类型声明也是一条语句,需要用分号终止.
将您的代码更改为此:
C++ requires you to know the type before you use them. Also a type declaration is a statement and needs to be terminated with a semi-colon.
Change your code to this:
public ref class ManagedGoo sealed
{
//...//
};
public ref class ManagedFoo sealed
{
void method(ManagedFoo^& mfoo,ManagedGoo^& mgoo)
{
//...//
}
};
希望这会有所帮助,
弗雷德里克·博纳德(Fredrik Bornander)
Hope this helps,
Fredrik Bornander
这篇关于cli类方法参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文