10. snoopy = Dog.new
def snoopy.alter_ego
"Red Baron"
end
class << snoopy
def alter_ego
"Red Baron"
end
end
仂仆从亳 束class <<損
仂从于舒亠 仄亠舒从仍舒
仍ミ頴笑覚 仂弍亠从舒, 从仂仂亶
于 从舒亢亳亠, 亳 亟舒亠 于舒仄
于仂亰仄仂亢仆仂 舒弍仂舒
仆亠仗仂亠亟于亠仆仆仂 于仆亳
仂弍仍舒亳 于亳亟亳仄仂亳 仂亞仂
仄亠舒从仍舒舒.
11. class << Dog
def closest_relative
wolf"
end
end
亊于仍 仂弍亠从舒仄亳,
从仍舒 仂亢亠 仄仂亞 亳仄亠
亳仆亞仍仂仆-仄亠仂亟.
亠仂亟 从仍舒舒 仆舒 舒仄仂仄
亟亠仍亠 磦仍磳 仆亳亠仄
亳仆仄 从舒从 亳仆亞仍仂仆-
仄亠仂亟舒仄亳. 舒从 亳 仍ミ英亠
亳仆亞仍仂仆-仄亠仂亟, 仂仆亳
舒仗仂仍舒亞舒ム 于仆亳
Dog
仄亠舒从仍舒舒 bark()
Dogs eigenclass
closest_relative()
12. class Dog
class << self
def closest_relative
wolf"
end
end
end
class Dog
def closest_relative
wolf"
end
end
class Dog
def self.closest_relative
wolf"
end
end
def Dog.closest_relative
wolf"
end