title: Storing/Loading C++ objects on/from disk
body: <pre><code>class MyClass
  {
     private:
        AnotherClass obj;
        float d;
        int k;
  
      public:
        MyClass(float d = 0.3, int k = 10);
        virtual ~MyClass();
        // other methods goes here
  }
  </code></pre>
  
  <p>Is it possible to have a method that allow this class (MyClass) to save to its attribute values on the disk (hard drive) <code>void storeOnDisk(string path){...}</code> and another method which allow to load the attribute values from disk <code>void loadFromDisk(string path)</code> ?</p>
  
  <p>If it is possible, should I also call <code>loadFromDisk(path)</code> in the constructor of MyClass (create another constructor maybe), and <code>storeOnDisk(path)</code> in the destructor of MyClass so that all current values can be saved when quitting the program that instanciated MyClass ?</p>