[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Interfaces in Ruby
From:       Paul Brannan <pbrannan () atdesk ! com>
Date:       2002-10-17 19:26:42
[Download RAW message or body]

On Fri, Oct 18, 2002 at 03:02:53AM +0900, Chris Gehlker wrote:
> > What would keep you from turning your cluster base class into a Module,
> > and using it as a mixin?
> 
> Because the 'is a' relationship is going the opposite direction. I use 
> Modules in Ruby where I would use MI in C++ and cluster bases where I 
> would use virtual classes. That way I have a nice clean inheritance 
> tree.

module Foo1
end

class Bar1
  include Foo1
end

b = Bar1.new
p b.is_a?(Foo1) #=> true

class Foo2
end

class Bar2 < Foo2
end

b = Bar2.new
p b.is_a?(Foo2) #=> true

The "is a" relationship looks to me like it's going the same direction
in both cases.

Paul


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic