--- Begin Message --- oke, then I would work with hour and minutes as the challenge wanted,
So still on the class side make code that convert any given hour and minute to a valid one ?

Yes. Such code would also be used when doing arithmetic with Times. e.g. if you were to implement an instance method named #addMinutes:, its implementation would be as simple as ^Time hours: self hours minutes: self minutes + anInteger (assuming the argument has that name). The instance creation method would normalize the new requested time, just like Time hours: 0 minutes: 70 would do.

Roelof



On some way I think or I do something wrong or I did misunderstood you.

 I did this in Pharo

Object subclass: #Clock
    instanceVariableNames: 'hour minute'
    classVariableNames: ''
    package: 'Exercise@Clock'

I made a asscesors on the instance side.

then I did this on the class side :

hour: anInteger minute: anInteger2
    self hour: anInteger2 % 60 + anInteger;
    self minute: anInteger2 / 60;
    yourself.

but I see a message that hour and minutes are not known.

Roelof


--- End Message ---

Reply via email to