Design pattern for dynamic function paremeter.

Hi,

I need to design an interface(a function prototype) that takes an argument which is used to pass information.
The information can be passed by independent modules and third party softwares and hence can vary today and in future.

Basically, the function interface(arg1, info)caters a niche service to many independent applications and needs to process based on requirements passed by applications in the argument(info, in example).

I am looking for a design pattern for the function parameter - info.

Should I use a void pointer that can be casted to respective application specific class in the function ? will this be a good C++ design ?

or should I take this parameter to be a pointer to a generic abstract class that points to the respective application specific specialization ?

Do we have some design pattern to address this so as to handle other unforeseen challenges ?
Should I use a void pointer that can be casted to respective application specific class in the function ? will this be a good C++ design ?
No

or should I take this parameter to be a pointer to a generic abstract class that points to the respective application specific specialization ?
Yes.

Do we have some design pattern to address this so as to handle other unforeseen challenges ?
I do not know what exactly you need, but bridge pattern may be of some interest for you: http://sourcemaking.com/design_patterns/bridge
Topic archived. No new replies allowed.