c++ - How to do operator overloading -
How do I write a program to overload an operator so that it can add two metrics?
to
This idea is derived from the syntax of C ++ operators Use the function to call. Such functions can give operators a user-defined meaning, to accept defined user-defined type parameters. For example:
Matrix Addition (Const Metrics and X, Const Metrics and Y); Matrix operator + (Const Metrics and X, Const Metrics and Y); Matrix Usage (Const Metrics and A, Const Metrics and B, Const Metrics and C) {Return Add (A, Add (B, C)); } Matrix Use _Plus (Const Metrics and A, Const Metrics and B, Const Metrics and C) {Return A + B + C; }
In addition to this, forum threads with Lensinwood discuss this in detail
Comments
Post a Comment