Реклама

Ruby – Inheritance

Our classification of objects in everyday life is naturally hierarchical. We know that all cats are mammals, and all mammals are animals. Smaller classes inherit characteristics from the larger classes to which they belong. If all mammals breathe, then all cats breathe. We can express this concept in ruby: Though we didn’t specify how a Cat should…