如何将以下类转换为类图,以及如何Train
和Wagon
之间的关系?
export class Buss{
id: number;
maxSpeed: number;
}
export class Train{
id: number;
model: string;
includesWagons?: Array<Wagon>; //<-- wagons class
}
export class Wagon{
id: number;
length: number;
weight: number;
}
export class Car{
id: number;
passangerSeat: number;
}
如果火车的多个对象包含许多货车怎么办?