Solved

27. Can we overload operations for internal data types?

Posted on 2015-01-24
5
49 Views
Last Modified: 2015-03-18
Can we overload operations for internal data types?
0
Comment
Question by:Nusrat Nuriyev
  • 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

776 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