0

シナリオ:

フォルダ: 接続

public class Connection 
{
    public void ServerConnect ()
    {
    . . . .
    }
}

フォルダ: クライアント

public void Connect 
{
     //In here, I want to implement the method from ServerConnect
}

ServerConnect を呼び出すにはどうすればよいですか?

4

3 に答える 3

1

のオブジェクトを作成し、Connectionそれを呼び出しますServerConnect()

public void Connect{
   public void Foo(){
     Connection con = new Connection();
     con.ServerConnect();
   }
}
于 2013-11-06T05:35:22.567 に答える
0

これがクラスを呼び出す方法です。

public void Connect 
{
     //In here, I want to implement the method from ServerConnect
     Connection c = new Connection();
     c.ServerConnect();
}
于 2013-11-06T05:35:47.730 に答える
0

Connection クラスのオブジェクトを作成し、次のようなメソッドを呼び出すだけです

Connection obj=new Connection();
 obj.ServerConnect();
于 2013-11-06T05:39:00.580 に答える