I have a base class "Animal", it has two derived classes, "Dog" and "Cat".
As my program creates new objects during its run, how would you save an Object, or Load an object once it has been saved?
I have checked all through my C++ book and have not found anything on Saving or loading Objects.
I can send the data of an object to a file by just saying,
fout << newDog;
if the file has been opened for input using fout.
Is this saving an Object? or is there more to it than meets the eye.
If this is saving an object, how would I create the object upon retrieving the data from the saved file?
My Animal class has the following private members,
(Age, Name, Sound, Weight). When I fout << newAnimal to the file, my file would look like this:
12 Spot Roof 27
When I opened this file How would I load an object?
Maybe i am looking to deep into a simple problem, I am fairly new to the C++ language.
Thanks for any help you can provide,