Operator overloading - lhs, rhs?

Discussion in 'C++' started by Guest, Jan 31, 2006.

  1. Guest

    Guest Guest

    Hi all,

    I have a function:

    mat4 operator * (const float scalar);

    (matrix times integer)

    Is there a way that I could multiply an int by a matrix, as opposed to only a matrix by an int?


    Thanks!
    Guest, Jan 31, 2006
    #1
    1. Advertising

  2. Guest

    Luke Meyers Guest

    <dontspam@_dylan_.gov> wrote:
    > Hi all,
    >
    > I have a function:
    >
    > mat4 operator * (const float scalar);
    >
    > (matrix times integer)
    >
    > Is there a way that I could multiply an int by a matrix, as opposed to only a matrix by an int?


    Careful, you posted twice.

    Try defining overloaded operators as free functions, rather than member
    functions. This addresses ordering considerations.

    Luke
    Luke Meyers, Jan 31, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    5
    Views:
    613
    Kai-Uwe Bux
    Jan 31, 2006
  2. bbrady
    Replies:
    2
    Views:
    949
    bbrady
    Jan 27, 2010
  3. fl
    Replies:
    10
    Views:
    438
    Juha Nieminen
    Jan 12, 2012
  4. Mr P
    Replies:
    21
    Views:
    203
    Brian McCauley
    Dec 28, 2005
  5. PerlFAQ Server
    Replies:
    0
    Views:
    304
    PerlFAQ Server
    Feb 8, 2011
Loading...

Share This Page