Listen to inheritance action : inherited « Reflection « Ruby






Listen to inheritance action


class MyClass

  def MyClass.inherited(subclass)
    puts "#{subclass} inherits from MyClass."
  end
end


class OtherClass < MyClass
end

# Output: OtherClass inherits from MyClass.

 








Related examples in the same category