gpt4 book ai didi

c# - 不一致的可访问性 : Parameter type is less accessible than method

转载 作者:IT王子 更新时间:2023-10-29 03:29:53 25 4
gpt4 key购买 nike

我试图在两种形式之间传递一个对象(基本上是对当前登录用户的引用)。目前,我在登录表单中有以下内容:

private ACTInterface oActInterface;

public void button1_Click(object sender, EventArgs e)
{
oActInterface = new ACTInterface(@"\\actserver\Database\Premier.pad",this.textUser.Text,this.textPass.Text);

if (oActInterface.checkLoggedIn())
{
//user has authed against ACT, so we can carry on
clients oClientForm = new clients(oActInterface);
this.Hide();
oClientForm.Show();
}
else...

在下一个表格(客户)中,我有:

public partial class clients : Form
{
private ACTInterface oActInt {get; set;}

public clients(ACTInterface _oActInt)

...这导致我得到:

Error   1   Inconsistent accessibility: 
parameter type 'support.ACTInterface' is less accessible than method
'support.clients.clients(support.ACTInterface)'
c:\work\net\backup\support\support\clients.cs 20 16 support

我真的不明白问题出在哪里 - 这两个字段都是私有(private)的,并且可以通过表单中的相关公共(public)方法访问。谷歌搜索并没有真正的帮助,因为它只是指向一个元素是公共(public)的而另一个是私有(private)的,但这里不是这种情况。

有人帮忙吗?

最佳答案

publicclients 的构造函数是 public 但它有一个类型为 ACTInterface 的参数 private(它嵌套在一个类中?)。你不能那样做。您需要使 ACTInterface 至少与 clients 一样易于访问。

关于c# - 不一致的可访问性 : Parameter type is less accessible than method,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6229504/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com