object Time{ def apply(h1: Int) = new Time(h1); } class Time(var h:Int) { if(h<0) h = 0; def hour:Int = h; def hour_=(x:Int){ if(x<0) h=0 else h=x; } override def toString() = "[" + hour + "]"; }