0

Scenario:

FOLDER: Connection

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

FOLDER: Client

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

How can I call ServerConnect?

4

3 回答 3

1

Create an object of Connection and then call ServerConnect() on it:

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

只需为 Connection 类创建对象并调用类似的方法

Connection obj=new Connection();
 obj.ServerConnect();
于 2013-11-06T05:39:00.580 回答
0

This is how you call classes.

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 回答