Paulo Matos wrote:
Hi all,
C++ FAQ Lite points you out to ABCs to define interfaces in C++,
however, in a well-defined big system which may consist of a huge
number of interfaces, the use of ABCs may incur in a very heave
performance penalty due to virtual functions, right?
Are there any alternatives to define "interfaces" in C++ without the
use of ABCs?
Regards,
Paulo Matos
A heavy penalty is paid when a client/employer looks at your code and
says to you: i find your system hard to use or impossible to expand
with. I haven't got the time or money to pay each one of my coders 100
hours just to learn how to use / or modify your code before being
productive. Or: i need special features without modifying the original
library. And i want to be able to add those features right now,
tomorrow and a decade from now.
Not to mention the cost of supporting that client.
>From those points of view, the cost of a virtual function call is far,
far down the list of priorities. In fact, the more interfaces you need
to expose, the higher the benefit of using abstract classes. If you
doubt that - that client might very well be you.
The best way to explain the true reason for having ABCs is: the
compiler is now able to help you code since the creator has written
rules guarenteeing that expanding an interface is simple and doing so
will *not* bring down the system. Thats truely priceless.