Boost logo

Boost :

Subject: Re: [boost] [interfaces] Boost Interface Library (2004?)
From: Daniel Larimer (dlarimer_at_[hidden])
Date: 2011-02-06 20:01:35


On Feb 6, 2011, at 5:58 PM, Edward Diener wrote:

> On 2/6/2011 4:18 PM, Joaquin M Lopez Munoz wrote:
>> Edward Diener<eldiener<at> tropicsoft.com> writes:
>>
>>>
>>> On 2/6/2011 3:07 PM, Daniel Larimer wrote:
>>>> I recently ran across the unofficial Boost Interface Library
>>>> (http://www.coderage.com/interfaces),
>>>
>>> How are is an interface any different than a C++ abstract class ?
>>
>> As the concept is defined by the aforementioned library,
>> interfaces allow for dynamic duck typing.
>
> It is not your problem but I did not get much of an understanding from the OP's original description of what advantages his implementation has over using C++ abstract classes to define interfaces. In other words what duck typing has to offer in terms of use which makes it better.

It is not always possible to change the inheritance hierarchy of other types that you want to use in a polymorphic way. Sometimes you need to add a polymorphic interface to a class that you do not want a vtable for. Every method in an abstract class becomes a virtual dispatch even when most use cases do not require or cannot benefit from virtual dispatching.

All of those reasons aside, my interest in the subject is because I want to dynamically create stubs for RPC, scripting, etc and there is no way to do that via an abstract class.

>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk