C++ Virtual keyword as away to avoid including code units.

Posted by user394663 on Stack Overflow See other posts from Stack Overflow or by user394663
Published on 2011-01-07T23:47:47Z Indexed on 2011/01/07 23:54 UTC
Read the original article Hit count: 192

Filed under:
|
|
|

Currently we have a body of code that allows service plugins which offer forms of communication to the core e.g tcp/ip, udp/ip, usb, etc... These service plugins feedback notifier class instances to the core for further processing.

In the current implementation a service project (which is a separate dynamically linked library brought in at runtime by the core via dlopen and friends) will compile against the notifier.cpp file that resides in the core source code (a separate project). This gives access to the notifiers method implementations. This works perfectly no complaints.

Two alternative options: 1. put the notifier method implementations in the header file. 2. declare the notifier methods virtual and delay binding until runtime.

Avoiding the issues of computational overhead what are the impacts of option 2?

Are there any other options available to us?

Thanks

© Stack Overflow or respective owner

Related posts about c++

Related posts about virtual