Re: Restricting access should be illegal?
Daniel James wrote:
In article news:<1154011341.612365.264030@m73g2000cwd.googlegroups.com>,
Greg Herlihy wrote:
Greg Herlihy wrote:
No, because there is a difference between invoking a method and
executing a method.
[I wrote]
That's a pretty fine distinction -- and one that many
users find confusing. I'm not sure that it is helpful to
make that distinction at all ...
The distinction between method invocation and method
execution is crucial for any understanding of what a virtual
method is. Because unlike a call to a non-virtual method -
which always executes the same method no matter how many
times it is called - a call to a virtual method can execute
one of any number of different methods and the method
executed can vary from one call to the next
Ah, I now understand what you're getting at. I understand
*that* distinction, but hadn't realized that it was to that
that you were referring.
I'll admit that I still don't quite understand what he is
referring to. We all know that virtual functions result in
dynamic binding, but what is the difference between invoking and
executing here?
You are using "invocation" to mean the call to a virtual
function /interface/ (for want of a better word) before any
overload resolution takes place; and "execution" to mean the
running of a particular overload of that interface after
resolution. I had understood both words to mean the latter
thing.
Incidentally: is this usage and meaning of "invoke" common in
the C++ community? If so I for one have failed to pick up on
it. We clearly need to have unambiguous terms to distinguish
the two stages in the process of calling and dispatching a
virtual method but I don't find invoke/execute particularly
felicitous.
The standard generally speaks of dynamic and static resolution,
I think. Things like access control and overload resolution use
static resolution; function invocation itself, however, uses
dynamic resolution if the function found by static resolution is
declared virtual (or overrides a function which was declared
virtual).
I see the standard itself talks about the "function called"
and its "final overrider" (5.2.2) and only uses the word
"invoke" when talking about macros.
I would say that "call" and "invoke" are pretty much synonyms
here.
--
James Kanze GABI Software
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]