Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!mahendo!wlbr!voder!pyramid!octopus!sjsumcs!horstman From: horstman@mathcs.sjsu.edu (Cay Horstmann) Newsgroups: comp.lang.c++ Subject: Re: Overloaded operator dot? Message-ID: <1991Mar11.061204.6023@mathcs.sjsu.edu> Date: 11 Mar 91 06:12:04 GMT References: <11152@jarthur.Claremont.EDU> Organization: San Jose State University - Math/CS Dept. Lines: 28 In article <11152@jarthur.Claremont.EDU> dfoster@jarthur.Claremont.EDU (Derek R. Foster) writes: >I have heard a few references lately to the possibility of adding to c++ >an overloadable operator dot. I have a few questions about this: > >1) Is the committee seriously considering this right now, or is this just > a suggestion? If they are considering it, what are the chances of it > passing? No idea... >2) If this suggestion is actually used, what is the syntax to invoke > the normal (un-overloaded) dot operator? > I guess one could always recover the original meaning by writing (&x)->m or this->m. Note that the -> applies to a pointer and hence cannot be redefined. By redefining operator& (unary), the first method may no longer work. In that case, the actual class members could only be used inside other member functions. Even if no member functions can be launched explicitly (because x.f() no longer means to call X::f() on x), some member functions can still be activated through constructors, destructors, overloaded operators and virtual functions. Inside those member functions, members can be accessed as this->m or simply m. Note that only the members of "this" can be accessed like that, not the members of any other object of the same class. What are the reasons AGAINST allowing overloading operator.? Cay