Thread: += Operator

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    59

    += Operator

    I have a main file rational.cxx and a header file rational.h.
    Everything seems to be working except i can't get the +=, *=, -=, and /= operators to work in the rational.cxx file.
    I have a function in rational.h so I can use it which is below.

    Code:
    int operator += (const rational& lhs, const rational& rhs)
    {
        return lhs += rhs;
    }
    For example when I get to the point in the program where += is located in the rational.cxx file I get a Segmentation Fault. I can't find why it's doing this I'm hoping it's just a silly mistake I made. I forgot to say I'm using a class in the header file which is why I need to do this. So any help would be appreciated.
    Last edited by StarOrbs; 05-01-2005 at 03:37 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Failure to overload operator delete
    By Elysia in forum C++ Programming
    Replies: 16
    Last Post: 07-10-2008, 01:23 PM
  2. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 07:05 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. Operator Overloading (Bug, or error in code?)
    By QuietWhistler in forum C++ Programming
    Replies: 2
    Last Post: 01-25-2006, 08:38 AM
  5. operator overloading and dynamic memory program
    By jlmac2001 in forum C++ Programming
    Replies: 3
    Last Post: 04-06-2003, 11:51 PM