Sha256: f18f0907a9690d4a2a4b48f1a7d5d896083db7a6928315dfb49928d95ea942dc
Contents?: true
Size: 1009 Bytes
Versions: 1
Compression:
Stored size: 1009 Bytes
Contents
require "myRubyGem/version" module MyRubyGem class Pet def initialize(name, gender, color) @name, @gender, @color = name, gender, color end def showName puts "Name: #{@name}" end def showGender puts "Gender: #{@gender}" end def showColor puts "Color: #{@color}" end end class Dog < Pet def initialize(name, gender, color, sound) super(name, gender, color) @sound = sound end def bark puts "Dog #{@sound}" end end class Cat < Pet def initialize(name, gender, color, nails) super(name, gender, color) @nails = nails end def scratch puts "Cat scratches with #{@nails} nails" end end dog = Dog.new("dog", "f", "black", "barks") dog.showName dog.showGender dog.showColor dog.bark cat = Cat.new("cat", "male", "white", "long") cat.showName cat.showGender cat.showColor cat.scratch puts "Program terminated" puts "Yet another dialog" end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
myRubyGem-0.0.1 | lib/myRubyGem.rb |