Thread: Overloading Operators

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    7

    Question Overloading Operators

    I'm working on a project and I need to overload some of the
    basic operators (*, /, +, -, etc...) to work with Measure, my user-
    defined class. I've managed to overload * so that Measure *
    double works (that is the double value is on the right hand of
    the binary operator), but I can't figure out how to reverse that so
    that I can get double * Measure to work.
    Does anyone have any idea how to fix this?

    On a side note, why does the server think I logged in as Strahan. I'm not Strahan, and I didn't even log in.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    friend measure operator * (double& d,measure& m)
    {
    // do stuff
    }

    ps I have assumed you are returning a measure.You may not be you didn't give much information.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    The thing about being logged in as Starahan automaticly: you must have selected "cookies" to be enabled on this site. Cookies are little files that contain your username + password ect. This enables the site to automaticly log you in without having to go to the log-in screen

  4. #4
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Oops. I meant to say that SOMEONE ELSE must have created the name Starahan on your computer and enabled cookies on this site.

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    7

    Smile

    Thanks. That did the trick.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question about overloading operators
    By *DEAD* in forum C++ Programming
    Replies: 9
    Last Post: 05-08-2008, 10:27 AM
  2. Replies: 16
    Last Post: 10-27-2007, 12:42 PM
  3. Overloading fstream's << and >> operators
    By VirtualAce in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2007, 03:17 AM
  4. operators overloading
    By waqasriazpk in forum C++ Programming
    Replies: 1
    Last Post: 07-26-2002, 01:05 AM
  5. Overloading operators...
    By Unregistered in forum C++ Programming
    Replies: 4
    Last Post: 11-21-2001, 08:24 PM