Solved

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

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Handle Exceptions during instantiation 28 427
FMX enumerated colours 2 132
gdb doesn't stop on breakpoint 2 111
How to add columns to a RAD Studio FMX grid at design time 1 27
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…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

713 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