On 08/06/14 22:11, Adriano dos Santos Fernandes wrote:
Alex and All,

Based on Alex code, I did some changes (attached) to support:
- Avoid runtime crash if a method is missed in an implementation
- Avoid need to manually initialize the vTable
- Avoid preprocessor tricks

OK for all this. very nice.
I've just added default for
typename Base = IVersionedImpl<Name, IRefCounted>

This makes simpler primary interface implementation (IMO 98% of cases).
class RefCounted : public IRefCountedImpl<RefCounted>

- Inheritance from implementations

The cost? Very low IMO.

You need to use an underline in interface methods, when
declare/implement and when calling a *inherited* method.

Example:

void MyImpl::method1_()    // Declaration, use underline
{
     method2();    // No underline here, this calls this->method2.
}

void MyImpl::method2_()    // Declaration, use underline
{
     MySuperImpl::method2_();    // Inherited/super method, use underline.
}


If we anyway need different ways to call different types of methods why have all this underlines?
May be better do

void RefCounted::addRefCaller()
{
    IRefCounted::addRef();
}

and let the rest of code look _much_ better?

Attachment: Interface-3.tar
Description: Unix tar archive

------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to