What kind of inheritance is that?


#1

I founded this code at WEBrick library:

class HTTPServer < ::WEBrick::GenericServer
def initialize(config={}, default=Config::HTTP)
super

What kind of inheritance is HTTPServer << ::WEBrick, I don’t undestand
de ::
before. What does it means?


Regards,

Luiz Vitor Martinez C.
cel.: (11) 8187-8662
blog: rubz.org
engineer student at maua.br

“Posso nunca chegar a ser o melhor engenheiro do mundo, mas tenha
certeza de
que eu vou lutar com todas as minhas forças para ser o melhor engenheiro
que
eu puder ser”


#2

What kind of inheritance is HTTPServer << ::WEBrick, I don’t undestand de ::
before. What does it means?

It’s there to make sure the right class is used. Try:

class A
def foo
“a”
end
end

module B
class A
def foo
“ba”
end
end

p A.new.foo
p ::A.new.foo

end

“ba”
“a”
=> nil