
7 Jul
2006
7 Jul
'06
2:24 a.m.
Gennaro Prota <gennaro_prota@yahoo.com> writes: [...] | template<class T> | class final | { | private: | final() { } | friend class T; | }; | | I'd add another base class to this so that the user hadn't to remember | to write virtual, but that's not the main point. In any case, this | does not prevent derivation: it prevents *instantiating* any derived | class (so a derived class which would only have static members... :)). | | It will probably get into boost when "friend class T" will become | legal; friend T; has been voted into the current draft of C++, i.e. it is now possible to declare a template parameter as a friend. You're right that it is not widely supported yet. -- Gaby