0

After reading several posts regarding this ruby koans scoping problem, read first, I found myself asking a question:

What is the advantage of being able to define a subclass say class Oyster in the form of say class MyAnimals::Oyster < Animal rather than nested in the Animal class? As this is a contrived example, I don't expect this to be explained using this example, but as I try to understand scope, I imagine there is a usefulness to having the nested lexical scope as having priority over inherited hierarchy. I think another question that gets at my confusion (which may be answered in a later koan) is does class MyAnimals::Oyster < Animal insides lie in the Animal class in a subclass of MyAnimals::Oyster or Oyster and if so, what does MyAnimals:: do exactly?

Community
  • 1
  • 1
  • `MyAnimals::Oyster`, `MyAnimals` is a module. – Justin Wood Jan 22 '14 at 01:24
  • I figured that a more subtle understanding of modules, classes and objects was how I would come to understand this question. Thanks. In the ruby koans, I haven't yet reached the about_modules section, so fun ahead. – ecualombian Jan 25 '14 at 00:55

0 Answers0