Jerivix Entadi wrote:
[color=blue]
> "John Harrison" <john_andronicus@hotmail.com> wrote in message news:<c1ca4e$1h0i4i$1@ID-196037.news.uni-berlin.de>...
>[color=green]
>>"Jerivix Entadi" <jerivix@hotmail.com> wrote in message[/color]
> Let me carify a bit. I don't know how to even save as binary data or
> XML. I've done a bit of experimentation with saving single lines of
> text, but past that I really don't know much.
>
> As far as object creation goes, I'm not worried about the constructor
> itself, but rather defining the objects in the first place. Is there
> any way to write soemthing that will create the objects for me?
>
> In other words, if I have a Class People, and the user inputs "Betty",
> can I then pass "Betty" into a function that will create an object for
> Betty and let the constructor etc. take it from there?[/color]
Search the newsgroups and web for "Design Pattern Factory".
This is a pattern used for creating instances given an indentifier
of some sort.
As for writing objects, the trick is to have each object provide
a method (or overload an existing operator) to write (and read)
each member. If the member is not a simple type, then it should
have read and write methods too.
The methods to use are the I/O streams. Also search the newsgroups
and web for "Serialization OR permanent C++". See the C++ FAQ:
http://www.parashift.com/c++-faq-lit...alization.html
One should always research the FAQ and search the newsgroups
(as well as the web) before posting. You can search for
"Thomas Matthews binary write" for some replies I've posted.
{Although I have improved the code a bit since then.}
--
Thomas Matthews
C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq:
http://www.parashift.com/c++-faq-lite
C Faq:
http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book