
I have a class that can be constructed statically in code, or constructed by data (this is where boost::serialization comes in). For example: class foo { public: foo() {} foo( std::string text ) : m_text( text ) {} private: template< class Archive > void serialize( Archive& archive, unsigned int version ) { archive & m_text; } std::string m_text; friend class boost::serialization::access; }; There is one problem with this, though. It is possible for a user of this class to create a "foo" with the default constructor, thus enabling them to have "zombie" objects. The only thing I want using the default constructor is boost::serialization, not the user. Is there a way I can make the default constructor private and still have boost::serialization access it? Keep in mind that this must work polymorphically too.