Advertisement
Guest User

Untitled

a guest
Apr 29th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.29 KB | None | 0 0
  1. class Troll
  2.     attr_accessor :nome, :hp, :cor
  3.    
  4.     def initialize(nome, hp, cor)
  5.         @nome = nome
  6.         @hp = hp
  7.         @cor = cor
  8.     end
  9.    
  10.     def gritar(grito)
  11.         puts "Meu nome é #{self.nome}"
  12.         puts "#{grito}"
  13.     end
  14. end
  15.  
  16. blinky = Troll.new("Blinky", 100, "Azul")
  17. blinky.gritar("Argh arg Arghu")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement