一貫性のないアクセシビリティ: パラメータ型はメソッドよりもアクセスしにくい 質問する

一貫性のないアクセシビリティ: パラメータ型はメソッドよりもアクセスしにくい 質問する

2 つのフォーム間でオブジェクト (基本的には現在ログオンしているユーザーへの参照) を渡そうとしています。現時点では、ログイン フォームには次のようなものがあります。

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

何が問題なのかよくわかりません。両方のフィールドはプライベートで、フォームから関連するパブリック メソッドによってアクセスされます。Google 検索は、1 つの要素がパブリックで、もう 1 つの要素がプライベートであると示すだけなので、あまり役に立ちません。この場合はそうではありません。

誰か助けてくれませんか?

ベストアンサー1

publicクラスのコンストラクタはclientsですpublicが、 型のパラメータがありますACTInterface(privateクラスにネストされていますか?)。これはできません。 をACTInterfaceと少なくとも同じようにアクセス可能にする必要がありますclients

おすすめ記事