Re: why creating pointer to reference member is illegal?
* Ryan McCoskrie:
Mathias Gaunard wrote:
Pointers only point to objects, functions, or member functions.
And primitives and other pointers
e.g.
int main(int argc, char **argv){
You can't call char **argv an object because that would mean that
it is some sort of class or structure.
Sorry, in C++ even a simple 'int' variable is an object, and in particular the
above example is an object.
The standard's definition of 'object' includes, first of all, the constraint
that "an object is a region of storage". Where at least formally a region of
storage needs not always be contiguous (the main example is for multiple virtual
inheritance, other examples are debatable, reducing to discussion of original
intent). A function is not an object, regardless of whether it occupies storage.
For example, the standard's requirement that a reference shall be initialized to
refer to an object or function would otherwise prohibit a reference to 'int'.
Cheers & hth.,
- Alf (terminologist)
--
Due to hosting requirements I need visits to <url: http://alfps.izfree.com/>.
No ads, and there is some C++ stuff! :-) Just going there is good. Linking
to it is even better! Thanks in advance!
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]