1

Ive been reading this article: https://www.thc.org/root/phun/unmaintain.html, and Ive been trying to implements steps Misleading names (search for isValid(x)) and How To Fix Unused Variable Errors (#29 under Miscellaneous Techniques).

I wish to do something more useful, (also according to the article) as doing more stuff on less lines is better.

Unfortunately, I have no idea on how to overload the assignment operator for a basic type. I know I could do something like operator=(&Other o) if I was using a class, but alas, C/C++ doesn't take after Java by having classes for some basic types...

Daniel Heilper
  • 1,182
  • 2
  • 17
  • 34
Shade
  • 775
  • 3
  • 16

1 Answers1

3

Unfortunately, I have no idea on how to overload the assignment operator for a basic type. I know I could do something like operator=(&Other o) if I was using a class

You cannot overload operators for built-in types in C++. And that's the end of the story.

but alas, C/C++ doesn't take after Java by having classes for some basic types...

...You make it sound like Java's distinction between int and Integer is somehow a good thing :)

fredoverflow
  • 256,549
  • 94
  • 388
  • 662