In C ++, why can we overload `operator ->` and cannot overload `operator.`

In C ++, why can we overload operator ->and cannot overload operator .?
Similarly, why can we overload operator ->*and cannot overload operator .*?
I will be grateful if you can help me!

+4
source share
1 answer

Stroustrup actually has this as a FAQ question on its website . To quote his answer:

Operator

. (dot) can in principle be overloaded using the same technique as for →. However, this may raise questions about whether the operation is intended to overload the facility. or the object referenced.

. ,

( , Stroustup operator., , .)

+4

Source: https://habr.com/ru/post/1688127/


All Articles