jeudi 30 mai 2019

C++ creating new operators and overloading the current ones

I am writing code for transposing a matrix as a part of learning C++. What I am doing is operator overloading. But, usually the notation for transposing a matrix is '.

Is ' even an operator? I understand if it is between ' ' you notate a character, and if you use " " you notate a string. But are these operators or not? Can I overload them as individual characters or even as whole?

Can I make new operators in C++ that only work on an object of a specific class? The trick I've used is overloading the known operators like +, -, ^, ... and then with #define I change how the preprocessor processes the text, but in the end I would still override an existing operator and I cannot use any of the special symbols but rather letters.

Aucun commentaire:

Enregistrer un commentaire