我有两节课:
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 允许吗?