class Parent
def self.singleton
@instance ||= new
end
end
class Child < Parent
end
p Parent.singleton.class # => Parent
p Child.singleton.class # => Child (!!)
Y2xhc3MgUGFyZW50CiAgZGVmIHNlbGYuc2luZ2xldG9uCiAgCUBpbnN0YW5jZSB8fD0gbmV3CiAgZW5kCmVuZAoKY2xhc3MgQ2hpbGQgPCBQYXJlbnQKZW5kCgpwIFBhcmVudC5zaW5nbGV0b24uY2xhc3MgIyA9PiBQYXJlbnQKcCBDaGlsZC5zaW5nbGV0b24uY2xhc3MgIyA9PiBDaGlsZCAoISEp