Наследование классов


#!/usr/bin/ruby

class ParentClass

    def initialize(name)
        @name = name
    end

end


class ChildClass < ParentClass

    def initialize(name, age)
        super(name)
        @age = age
    end

    def show
        puts "#{@name} = #{@age}"
    end

end


x = ChildClass.new "Ivan", "20"
x.show