Thread: Help with Operator Overloading

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Aug 2007
    Location
    U.K.
    Posts
    148
    Thanks tabstop.

    That gives me some concern.

    I'm actually storing pointers to objects you see within a vector, so can I ask what would be the right way of being able to save all the objects to the text file?

    I'm not asking for the code or anything, but I'd really appreciate some direction on how to go about being able to save them.

    Again, thanks.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Swerve View Post
    Thanks tabstop.

    That gives me some concern.

    I'm actually storing pointers to objects you see within a vector, so can I ask what would be the right way of being able to save all the objects to the text file?

    I'm not asking for the code or anything, but I'd really appreciate some direction on how to go about being able to save them.

    Again, thanks.
    I'm concerned about your concern. If vectorname[a] is a pointer to a Diary (and we know it is), then *(vectorname[a]) is a Diary object. This is not difficult.

    (EDIT: Now what will be difficult is trying to do polymorphism, which I think you're trying to do, using a base object as a parameter (instead of calling a member function from the pointer-to-base). In fact, I'm moderately certain it can't be done in C++, or at least I haven't thought up/remembered a way to do it yet.)
    Last edited by tabstop; 10-23-2009 at 06:20 PM.

Popular pages Recent additions subscribe to a feed