class Creature{ val range:Int=10 val env:Array[Int]=new Array[Int](range)}class Ant extends Creature{ override val range=2}ide
運行時env的length爲0,若是但願length爲咱們認爲的2it
須要class
class Ant extends{override val range=2}with Creaturenew