Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!cornell!rochester!kodak!elmgate!jdg From: jdg@elmgate.UUCP (Jeff Gortatowsky CUST) Newsgroups: comp.lang.c++ Subject: A question or two from a Beginner Message-ID: <1001@elmgate.UUCP> Date: 12 Jan 89 01:56:08 GMT Reply-To: jdg@aurora.UUCP (Jeff Gortatowsky) Organization: Eastman Kodak Company, Rochester NY Lines: 39 Well after reading the available news in this group for the first time it appears C++ is still in qutie a state of flux. I'm an 'experianced' C programmer who has just started to use C++. My two platforms are a Sun (G++) and a PC (Zortech). But my questions are generic. I apologize if they seem 'dumb'. First, the string class shown on page 185 of "The C++ Programming Langauge". A few pages further on Mr. Stroustrup explains that operators which may have a non-lvalue operands should be 'friends' of a class. This made good sense until I backed up to the friend functions of the string class. Take for example (using that class example) string foo ("abc"); if ("ABB" == foo) { ..... etc.... Would not the compiler complain in any case that the arguments do not match either of the two '==' operator functions declared? Shouldn't there be another overloaded '==' function that takes a char* first and a string object reference second? Is "ABB" automagically converted to a string object and the 2nd '==' friend function called? If so then a constructor would be called, yes? And right after the if statement the destructor? Is the example string class complete? Will the compiler reverse the two operands? No it couldn't, could it. That would mess up operators such as <= or >. Did I miss something? References in C++ really mess me up. Anyone got a lucid explanation for a C programmer? Reference to me always meant "address of". To Mr. Bright. I had no problems obtaining or using your compiler (1.07). But then I'm a C++ novice and have no non-trivial code to compile yet. I'm looking forward to future releases. Thanks for the work. Sorry for the length. Thanks for any helpful answers. -- Jeff Gortatowsky-Eastman Kodak Company .....rochester!kodak!elmgate!jdg (use uuhosts or such to find path to rochester) Eastman Kodak makes film not comments. Therefore these comments are mine not theirs.