Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

26. What operations can not be overloaded? How do you think, why?

Posted on 2015-01-24
4
Medium Priority
?
117 Views
Last Modified: 2015-03-17
What operations can not be overloaded? How do you think, why?
0
Comment
Question by:Nusrat Nuriyev
  • 2
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 2000 total points
ID: 40568260
The operators that cannot be overloaded are



.
 Member selection
 
.*
 Pointer-to-member selection
 
::
 Scope resolution
 
? :
 Conditional
 
#
 Preprocessor convert to string
 
##
 Preprocessor concatenate

Source: https://msdn.microsoft.com/en-us/library/5tk49fh2.aspx 

Sorry about the copy&paste, they were just to many to write down ;o)
0
 
LVL 86

Assisted Solution

by:jkr
jkr earned 2000 total points
ID: 40568262
Ooops, forgot the "Why?" part - Bjarne answers that here: http://www.stroustrup.com/bs_faq2.html#overload-dot
And I won't copy that here, since I had to look that up myself ;o)
0
 

Author Comment

by:Nusrat Nuriyev
ID: 40606139
Okay :)
0
 

Author Comment

by:Nusrat Nuriyev
ID: 40670583
	class Y {
	public:
		void f();
		// ...
	};

	class X {	// assume that you can overload .
		Y* p;
		Y& operator.() { return *p; }
		void f();
		// ...
	};

	void g(X& x)
	{
		x.f();	// X::f or Y::f or error?
	}

Open in new window


I don't get this example, could you help?
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

886 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