[C++-sig] (Stefan Seefeld)(Nat Goodspeed) pass function pointer to c

Qinfeng(Javen) Shi shiqinfeng at gmail.com
Sat Oct 7 10:06:40 CEST 2006


Stefan and Nat,

Thanks for your suggestion.
Maybe I don't explain my requirement clearly.

The reason why I don't pass a string parameter then assgin a funtion pointer
inside the process() is that,
I want to provide a extendable interface.The goal is that user can provide
any new operation function without rewriting process().
For instance, if a user write a new operation function called "multiply"(any
name but I could't know what name he would like to give), he can still call
process(arg1,..., multiply). One day another user write another operation
function called "vectorproduct", he can also call
process(arg1,...,vectorproduct).

If I do it in Stefan's way, every time when user provide a new operation
function, the process() has to be rewriten. User may not want to rewrite
process() code every time, and furthermore the source code of process() is
not always provided for users.

Thanks. Do you get me now?
-- 
Qinfeng(Javen) Shi

Research School of Information Sciences and Engineering
Australian National University
Locked Bag 8001
Canberra ACT 2601
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20061007/6bceb5f0/attachment.htm>


More information about the Cplusplus-sig mailing list