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

List:       ruby-talk
Subject:    Redefining inheritance?
From:       "Caleb Tennis" <caleb () aei-tech ! com>
Date:       2005-05-06 17:46:32
Message-ID: 36462.192.168.2.102.1115401544.squirrel () aei-tech ! com
[Download RAW message or body]

Suppose I have this:

class A
class B < A

Now, in my unit tests, I create a mock object to use for testing purposes:

class MockA < A

What I need now is a MockB, which inherits from MockA

class MockB < MockA

But I still need all of the methods which I have previous defined inside
of B.  Note that MockB doesn't have any relation to the actual B, unless I
go back and redefine all of these methods within MockB itself.

So, is there a way I can create a "MockB < B", but dynamically make "B
inherit from MockA instead of the real A"


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

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