問Y-1
クラス(モジュール)にはancestorsという、そのクラスの親を一覧するメソッドがあります。以下のインスタンスについて、その所属するクラスのancestorsを表示してください。
・String 例: "aaa"
・Array 例: [1, 2, 3]
・自作のクラス
また、これらに共通するクラス/モジュールを表示してください
問Y-2
1) 地下鉄の「路線を表すクラス」「駅を表すクラス」を考えて、コードで表してください。
2) これらのインスタンスを、「福岡市営地下鉄空港線」を例に作成してください。
3) この二つのクラス(とRubyの標準クラス)を使い「駅Aから駅Bを与えたら、何駅かかるか答える」メソッド show_distance を「路線を表すクラス」に実装してください。```
問Y-3
1) 以下のクラスの継承関係を考えて、コードで表してください。
Animal, Mammal, Bird, Fish, Dog, Bulldog, Shiba, Whale, Chicken, Quail, Salmon, Sardine
2) また、それぞれのクラスに以下のインスタンスメソッドを実装し、true/falseを返してください。継承を使いなるべく少ない記述にしましょう
* has_backbone? # 背骨があればtrue
* laying_eggs? # 卵を産めばtrue
* thermostatic? # 恒温動物であればtrue
* aquatic? # 水生生物であればtrue