Re: [GD-General] Eiffel
Brought to you by:
vexxed72
From: Thatcher U. <tu...@tu...> - 2001-12-27 21:53:42
|
On Dec 22, 2001 at 04:30 -0800, Jesse Jones wrote: > > Unfortunately MI has a bad reputation in C++. Even people who should > know better like Scot Myers rag on it. But essentially all of the > problems with MI in C++ are because of virtual base classes. So how > do you avoid virtual base classes? By avoiding diamond shaped > inheritance hierarchies. > > One way to do this is by using mixin classes. You have your main-line > classes like Widget or Monster or whatever and then you have mixin > classes like ReferenceCountedMixin or ObserverMixin or whatever. > Mixins only descend from other mixins so you never wind up with the > diamond of death. I've been pondering this. I've always depended on virtual inheritance for effective mixins. For example, how do you implement smart pointers to mixins of ref-counted classes, without virtual inheritance? It would be great if I'm wrong, since virtual inheritance is a PITA in some ways (in other ways, I think it's the only usable form of C++ MI, but lets leave that aside for now). -- Thatcher Ulrich <tu...@tu...> http://tulrich.com |