概要
Rubyの継承階層の確認について説明します。
サンプル
class Parent attr_accessor:name def initialize(name) @name=name end end class Child < Parent end child = Child.new("hoge") puts child.name puts child.is_a? Parent puts child.kind_of? Parent puts child.instance_of? Parent
出力
hoge true true false