From: Minero Aoki Date: 2003-06-28T04:53:05+09:00 Subject: [ruby-list:37835] Re: reference from nested class to a constant in a module included by the parent class 青木です。 In mail "[ruby-list:37834] Re: reference from nested class to a constant in a module included by the parent class" NISHIMATSU Takeshi wrote: > 西松です. > > 自分で定義されたもの > > その外側のクラスで定義されたもの > > そのまた外側で定義されたもの(以下トップレベルまで続く、トップレベル含まない) > > スーパークラスで定義されたもの > > そのスーパークラスで定義されたもの(以下Objectまで続く、Object含まない) > お返事をありがとうございます. この場合, > 下の例の★はどの条件に合致していると考えればよいのでしょうか. > module M > ConstM = "M" > end > class Parent > ConstP = "P" > include M > p ConstP # => "P" > p M::ConstM # => "M" > p ConstM # => "M" ★ 四つめの「スーパークラスで定義されたもの」です。 include は実質的に継承と等しいので、スーパークラスと言うと たいていは include したモジュールのことも含みます。 ------------------------------------------------------------------- 青木峰郎