• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 61
  • Last Modified:

27. Can we overload operations for internal data types?

Can we overload operations for internal data types?
0
Nusrat Nuriyev
Asked:
Nusrat Nuriyev
  • 3
  • 2
1 Solution
 
jkrCommented:
That pretty much goes with your 'operator overloading' question at http://www.experts-exchange.com/Programming/Languages/CPP/Q_28603163.html - yes, you can overload all operators, except the ones listed there. See http://en.wikibooks.org/wiki/C%2B%2B_Programming/Operators/Operator_Overloading for a comprehensive list how to overload each operator.
0
 
Nusrat NuriyevAuthor Commented:
okay, let me see those links
0
 
Nusrat NuriyevAuthor Commented:
I'm little bit confused. So there are two things operator overloading and operation overloading?
0
 
jkrCommented:
Well, maybe I was on the wrong track, I really thought you meant 'operators' as well. If you meeen 'operations' as in 'method' calls - yes, that also, if you refer to an 'internal type' as e.g. a class/struct embedded in another class such as

class Foo {

  struct Bar {

    int x;
    int y;
  };

};

Open in new window

0
 
Nusrat NuriyevAuthor Commented:
The answer is:
No, because datatype - is a set of data and operations over that. Changing semantics of datatype, we change the definition of type.

Ok, seems I have mistranslated the question from russian. It was about plain data types(not "internal types") like. Maybe I have to say, "built-in types" or POD types (however, I am not fully understand it).
Next time I will review the answer first, and after that, will ask, if needed, because there are answers, but they are extremely small and sometimes it's hard to get it.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now