Created
October 14, 2015 21:52
-
-
Save allolex/f17b542a977e72385a0e to your computer and use it in GitHub Desktop.
Revisions
-
allolex created this gist
Oct 14, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ require_relative 'talkative' class Vehicle attr_accessor :engine, :tires end class Car < Vehicle def initialize @tires = 4 end end class Motorcycle < Vehicle def initialize @tires = 2 end end class TelevisionCar < Car include Talkative end kitt = TelevisionCar.new p TelevisionCar.ancestors p TelevisionCar.superclass kitt.speak puts kitt.tires # c = Car.new # p Car.superclass # c.engine = "small" # p c.engine # # m = Motorcycle.new # p Motorcycle.superclass # m.engine = "smaller" # p m.engine This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ module Talkative def speak puts "hello" end end