42 lines
462 B
Ruby
42 lines
462 B
Ruby
|
class Heure
|
|||
|
|
|||
|
def initialize(h = 0, m = 0, s = 0)
|
|||
|
@heure = h
|
|||
|
@minute = m
|
|||
|
@seconde = s
|
|||
|
end
|
|||
|
|
|||
|
def heure()
|
|||
|
@heure
|
|||
|
end
|
|||
|
|
|||
|
def minute()
|
|||
|
@minute
|
|||
|
end
|
|||
|
|
|||
|
def seconde()
|
|||
|
@seconde
|
|||
|
end
|
|||
|
|
|||
|
def heure=(h)
|
|||
|
@heure = h
|
|||
|
end
|
|||
|
|
|||
|
def minute=(m)
|
|||
|
@minute = m
|
|||
|
end
|
|||
|
|
|||
|
def seconde=(s)
|
|||
|
@seconde = s
|
|||
|
end
|
|||
|
|
|||
|
end
|
|||
|
|
|||
|
x = Heure.new(15,20)
|
|||
|
puts "Heure : #{x.heure}"
|
|||
|
puts "Minutes : #{x.minute}"
|
|||
|
puts "Secondes : #{x.seconde}"
|
|||
|
|
|||
|
x.heure = 16
|
|||
|
puts "Heure modifi<66>e : #{x.heure}"
|