title: How to Serialize classes with inheritance in C++
body: <p>I want to Serialize a class that's part of inheritance. I'm using C++98 and no 3rd party libraries. Here is my class structure:</p>
  
  <pre><code>class Base{
  public:
      virtual RunMe()=0;
  };
  
  class Derived: public Base{
      virtual RunMe(){
          std::cout &lt;&lt; "I am running &lt;&lt; std::endl;
      }
  };
  </code></pre>
  
  <p>I am able to Serialize a basic class using ofstream and fstream, via friend technique. But I can't figure out how to implement Serialization in case where my Base class has a pure virtual function.</p>