Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Time2(private[this] var h:Int, private[this] var m:Int){
- require(h > 0 && h < 24 && m > 0 && m < 59)
- def hour:Int = h
- def hour_=(h:Int) {
- require(h > 0 && h < 24)
- this.h = h
- }
- def minute:Int = m
- def minute_=(m:Int) {
- require(m > 0 && m < 59)
- this.m = m
- }
- def before(other:Time2):Boolean =
- other.hour > h || other.hour == h && other.minute > m
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement