Boost logo

Boost Users :

From: james.jones_at_[hidden]
Date: 2006-10-31 19:01:25


From: "Wu Yinghui, Freddie" <yhwu_at_[hidden]>
> To use the class hierarchy, my program loads the DLL requested by user
> using LoadLibrary() (We're using Windows, but it should be similar to
> Linux, I suppose), and makes use of the Derived1/Derived2 classes via a
> pointer to the Base class.
>
> Since I have no information about the derived classes when building my
> main executable (only Base class is known then), I cannot make direct
> use of Derived1/Derived2 types in my main program. -- Yet, I need a way
> to provide some arbitrary set of arguments to the derived classes.
>
> Hope my explanation clears your doubts. Do you have any suggestion or
> alternative design in mind?

Try a single boost::any parameter. Then pass structures as needed. This is essentially equivalent to the void* method everyone used in the bad old pre-Boost days, but it's type-safe.

-
James Jones Administrative Data Mgmt.
Webmaster 375 Raritan Center Pkwy, Suite A
Data Architect Edison, NJ 08837


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net