Get this (overlaoding the assignment "=" operator...

okay, lets say you got an object (an Abstract Data Type using "struct"
or "class"), and you're overloading the operator "=".

object:: &operator=(object temp) // <--- I know I left out some stuff
{
this = temp;
}

isn't that the dumbest thing? I spent an hour trying to figure out
what was wrong with it; the compiler always becomes "evil" whenever
I try to overload an operator.

Comments

  • : okay, lets say you got an object (an Abstract Data Type using "struct"
    : or "class"), and you're overloading the operator "=".
    :
    : object:: &operator=(object temp) // <--- I know I left out some stuff
    : {
    : this = temp;
    : }
    :
    : isn't that the dumbest thing? I spent an hour trying to figure out
    : what was wrong with it; the compiler always becomes "evil" whenever
    : I try to overload an operator.

    ----> If you cant figure it out, it just recursively calls itself
    ----> in an endless loop;

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion