Differing implementations for a function in two interfaces

Lionello Lunesu lio at lunesu.remove.com
Sun Apr 16 23:19:30 PDT 2006


Hasan Aljudy wrote:

<snip>

> A bit more complicated (for this simple example), but you're doing the 
> same thing: creating new entries in a vtable, to choose different 
> functions at runtime.


Your solution is pretty close to what I had in the first place. The 
reason I didn't like it was because of all the "new"s. CA and CB don't 
contain any data, but must be new'ed nonetheless. Furthermore, in your 
code you have to keep passing the C class to each call on CA and CB: not 
a viable solution.

L.



More information about the Digitalmars-d-learn mailing list