Solved

27. Can we overload operations for internal data types?

Posted on 2015-01-24
5
53 Views
Last Modified: 2015-03-18
Can we overload operations for internal data types?
0
Comment
Question by:Nusrat Nuriyev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 40568265
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
 

Author Comment

by:Nusrat Nuriyev
ID: 40606140
okay, let me see those links
0
 

Author Comment

by:Nusrat Nuriyev
ID: 40670594
I'm little bit confused. So there are two things operator overloading and operation overloading?
0
 
LVL 86

Expert Comment

by:jkr
ID: 40671205
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
 

Author Comment

by:Nusrat Nuriyev
ID: 40674674
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question