Does it have access control for remote designers?

Is there a difference in behavior between an explicitly remote constructor public, protectedor private?

For example, a non-copyable class must have a remote copy constructor (and a remote copy destination). The constructor will not be accessible to subclasses (or friends), nor to external users of this class, since it does not exist, regardless of its access control.

The only difference that I see will be how the various scopes will see that the copy constructor does not exist - whether it exists (as far as this scope is known) or explicitly deleted.

Now it would be useful to have a better formal interface for the class - that is, if everyone should know that the class is not being copied, it should be publicly deleted. Compiler error messages may also be more informative. But other than that - will there be any real observable difference in class behavior? That is, something could be done with a class that has its own remote constructor with access X, which he could not do if this constructor had access to Y?

+4
source share
1 answer

Since this is an overload resolution that makes the program poorly formed in this case, and not access specifiers (which are checked later), there is no difference in the results. The compiler will always complain about the removal of a remote function.

, ++ 11 ", c'tor, ", , , , . " " - , , .

+7

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


All Articles