Solved

27. Can we overload operations for internal data types?

Posted on 2015-01-24
5
47 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now