Thread: Finishing my "int class"... help with weird operator overloads

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    417

    Finishing my "int class"... help with weird operator overloads

    This class stores the data as a string, but the operator overloads make it act like an integer. Problem is, I'm not quite sure how to go about doing this with the remaining operators. They're listed at the bottom of the post.

    I need 4 possibilities each (these are already completed): (i.e.: a+=1 means a = a + 1 )

    const ooint & operator += ( const ooint & str ); // add str to CString
    const ooint & operator += ( const char * s); // add str to CString
    const ooint & operator += ( char ch ); // add str to CString
    const ooint & operator += ( int rhs );

    Something like that, but I still don't have it figured out.

    Operator/Operation Performed
    &= Bitwise-AND assignment
    |= Bitwise-inclusive-OR assignment
    ^= Bitwise-exclusive-OR assignment
    ++ Increment operator
    -- Decrement operator

    I need all of those with 4 each (all possible combinations), and I have no clue how to go about some of them because I don't know how they work.

    http://cboard.cprogramming.com/showt...threadid=29575 has more information on my class if you need it.
    Last edited by Trauts; 12-06-2002 at 09:39 AM.

Popular pages Recent additions subscribe to a feed