|Do you know where your variables are?|
Re^2: Class::InsideOut - yet another riff on inside out objects.by adrianh (Chancellor)
|on Dec 24, 2002 at 20:31 UTC||Need Help??|
Does your approach supports inheritance? multiple inheritance?
Yes and yes. For example:
Does Abigail-II's approach supports multiple inheritance?
Yes (and my method is Abigail-II's method with some syntactic sugar and a different DESTROY mechanism).
The advantage of doing it this way is that some kinds of problems caused by the traditional hash mechanism disappear because it is guaranteed that there is no sharing of attributes between classes.
One of the problems of using a traditional hash is that if two different classes use the same hash key to index an attribute then you cannot directly inherit from both of them (because they try and use the same bit of the hash for different purposes). You can use things like Class::Delegation to get around this problem, but it is more work - and tracking down the bug can take time.
Of course, all this depends on what you mean by multiple inheritance! Some languages (e.g. Eiffel) have a far more flexible approach to MI than languages like C++, Java & Perl.
For example, Class::InsideOut doesn't support inheriting from a class multiple times and having multiple copies of the attribute. But this isn't supported in the perl hash-style object implementation either.
If you're interested in multiple inheritance I would spend some time introducing yourself to inheritance in Eiffel (this page has some pointers) which is the most comprehensive model of MI I've come across in any language. It's quite hard to do some things in perl that are trivial in Eiffel.... Hmmm... might be worth a meditation at some later date...