All pastes #403388 Raw Edit

Anonymous

public ruby v1 · immutable
·published 2007-03-20 10:12 UTC
rendered paste body
#!/usr/bin/env rubyclass Animal		def initialize(nom = "Oscar")				@nom = nom				@race = "chat"				@age = 1          # age est exprimé en année 		end				def getNom				@nom		end				def getRace				@race		end				def getAge				@age		end				def marcher(pas)				@distance = @distance + pas				puts @nom + " à fait " + @distance.to_s + " pas."		endenda = Animal.newputs "Cette animal est un " + a.getRace + ". Il a " + a.getAge.to_s + " ans et il s'apelle " + a.getNom + "."a.marcher(15)a.marcher(2)