That's a good idea. I tend to ignore the menu options for creating classes and things like that because I prefer to actaully write them, but if it gets rid of problems like this then that can only be good. What's the syntax for defining/declaring an operator (like +) for a class?
That's very helpful. The only problem I can think of at the moment is that I wanted to make classes so that it could be limited int or limited unsigned or limited unsigned char. I could make all these individually apart from that fact that I don't know how to make the name of a class include spaces. Is it possible, or would it have to be limited_int? Also, I've just made four operator overloads:
But it comes up with an error saying that the third one cannot be overloaded with the first one and the fourth one cannot be overloaded with the second. How can I set it up so that all of th following are possible:
int = limited_int + limited_int;
limited_int = limited_int+limited_int;
int = limited_int + int;
limited_int = limited_int + int;
I'm thinking that I need to make it able to convert from limited_int to int (very easy, just return the value variable) but I don't know how.