Solved

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

Posted on 2015-01-24
4
63 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 500 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 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

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…
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 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 how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

759 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

19 Experts available now in Live!

Get 1:1 Help Now