Ok, I know how to overload an operator. I have successfully overloaded +, -,=, * for a matrix class. I am trying to do inversion of a matrix. I have the code working for the inversion but I do not know how to properly overload the function I want.

I have it now as :

aInverted = /a; // in main
matrix matrix::operator/(const matrix& inputted) // function declaration

The reason I suspect the code doesn't work is because all of my other functions had (operand) (overloaded operator) (operand) and this is just (overloaded operator) (operand).

The error I get is error C2059: syntax error : '/'.

I need to keep the main function the way it is such as aInverted = /a;

The arity and precedence of operators is fixed by their standard usage in C++. So / needs two parameters.

You need to pass two parameters to the function, I guess you could always do something like overload /= ?

Chris

Better yet, use ! or ~

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.