/* * Serializeable.h 2014-12-04 * * Implements the NVI pattern. Override to_str() in all concrete subclasses. */ #ifndef SERIALIZEABLE_H #define SERIALIZEABLE_H #include class Serializeable { public: virtual ~Serializeable() = default; std::string str() const { return to_str(); } private: virtual std::string to_str() const = 0; }; #endif