Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- class Animal
- attr_reader :name, :age
- def initialize(name, age)
- @name = name
- @age = age
- end
- end
- class Dog < Animal
- def self.check_name
- puts "hello dog" if name =~ /perla/
- end
- end
- dog = Dog.new("perla", 7)
- puts dog.name
- dog.check_name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement