You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Metaprogramming is the act of writing code that operates on code rather than on data. This involves inspecting and modifying a program as it runs using constructs exposed by the language.
require_relative 'metaprogramming2'
require 'pry'
class Animal
include SuperPowers
def self.inherited(subclass)
puts "a new subclass of #{subclass} was created"
# binding.pry
end
end
class Dog < Animal
end
class Cat < Animal
end
# every time a new subclass is created, print the statement