Angus Leeming <[EMAIL PROTECTED]> writes: | Jean-Marc Lasgouttes wrote: >> A little digression: instead of our current os:: namespace, wouldn't >> it be better to have a hierarchy of os_foo classes with static >> methods, so that some environment could inherit others (like cygwin = >> unix + some stuff). The some of the code from this init method could >> be moved to os_foo.C files. > | You can't have static virtual member functions, but you could have either | a "class os" (à la 13x) or a "namespace os" (à la 14x) that hid the | implementation: > | class os { | public: | static void init(int argc, char * argv[]); > | static string const & binpath(); | static string const & binname(); | static string const & homepath(); | static string const & nulldev(); | private: | struct impl { | virtual string const & binpath() const = 0; | virtual string const & binname() const = 0; | virtual string const & homepath() const = 0; | virtual string const & nulldev() const = 0; | }; | static boost::scoped_ptr<impl> pimpl_; | };
Will this work? Remember that you can call a static function without the object. (Ok I see what you want to do. (init should be private probably)) -- Lgb