有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java是一个实体类,可以在OOAD中返回其他实体实例吗?

我有两门课:

public class Car
{
    private int id;
    private String name;
    private String vendor;

    /* ... */
}

public class Garage 
{
    private int id;
    private String name;
    private String address;

    /* get-set and others stuffs */

    public boolean addCar(Car c) {
        /*
            This will insert a car to tblCars
            but belong to this garage
        */
    }

    public List<Car> getListCar {
        /* 
            This will perform a SELECT query on tblCars
            to choose cars belong to this Garage
        */
    }
}

OOAD允许吗


共 (0) 个答案