1 Nov 01:01
Re: [Boost.Parameter] How to Use Named Parameters in a Class Hierarchy?
<james.jones <at> firstinvestors.com>
2006-11-01 00:01:25 GMT
2006-11-01 00:01:25 GMT
From: "Wu Yinghui, Freddie" <yhwu <at> volumeinteractions.com> > 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
RSS Feed