1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| class Location { position: string constructor(position: string){ this.position = position } } class Stratege { locations: Location [] = [] constructor(...locations){ this.locations = locations console.log('路线经过了') this.location.forEach(el=>{ console.log(el.position+ ',') }) } } class Move { start: Location end: Location stratege: Stratege constructor(){ this.start = new Location('1 1') this.end = new Location('0 0') const sea = new Location('1 0') const land = new Location('1 0') this.stratege = new Stratege(this.start, sea, this.end) } }
|