“从另一个类型使用的类型必须是公共的”是什么意思?错误是什么意思?
Delphi Prism for .NET:
对于我的某些成员函数,我收到错误“从其他类型使用的类型必须是公共的”。
例如,看一下我的一些引发错误的成员函数。
method ConnectTest(x,y,pg:integer):TConnection; virtual; <---error - TConnection must be public
method Addtheobject(co:TControlObject); <--- TControlObject must be public
method ClearCache(cc:TCacheType); <--- TCacheType must be public
所有这些方法都来自公共访问说明符下的类内。
那么,他们为什么要提出这个错误呢?
谢谢,
Delphi Prism for .NET:
For some of my member functions, I am getting an error, "A type used from another type must be public."
For instance, take a look at some of my member functions that are raising the error.
method ConnectTest(x,y,pg:integer):TConnection; virtual; <---error - TConnection must be public
method Addtheobject(co:TControlObject); <--- TControlObject must be public
method ClearCache(cc:TCacheType); <--- TCacheType must be public
All these methods are from within a class under public access specifier.
So, why are they raising this error?
Thanks,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有一个返回类型
T
的public
方法或具有类型T
的参数,则T
还必须是公开
。否则,很容易出现这样的情况:可以调用您的方法,但无法提供其参数,或者无法存储/检查其返回值等。If you have a
public
method that returns a typeT
or has a parameter of a typeT
, thenT
must also bepublic
. Otherwise, the situation could easily arise where your method could be called, but its arguments couldn't be supplied, or its return value couldn't be stored/inspected/etc.