Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!samsung!uunet!dlogics!dsa From: dsa@dlogics.COM (David Angulo) Newsgroups: comp.lang.c++ Subject: Re: Resolving an Overloaded Function Call Summary: evaluate: (int == char) Keywords: overloading Message-ID: <585@dlogics.COM> Date: 8 May 90 00:26:54 GMT References: <35925@think.Think.COM> <2619@ektools.UUCP> Distribution: usa Organization: Datalogics Inc., Chicago Lines: 38 In article <2619@ektools.UUCP>, randolph@ektools.UUCP (Gary L. Randolph) writes: > > In C++, the type of a literal character constant is char; in C > it is int. > He goes on to state the purpose for this is to overload on char. > > > #expression 'a' is 'int' not char so I don't see how this could be an > #exact match. Is C++ different from C in this regard? > ^^^^^^^^^^^^^^^Yes. Did this change in 2.0? I had a problem recently because I had defined a class something like this: class a { a (int); a (char*); }; When I used it, I had forgotton which constructors I had defined, so I coded: char a_char; a an_a (a_char); When I finally tracked it down, I realized that it was using the "int" constructor. I thought "Well, you would think that it would at least give you a warning," and proceeded to make the "char" constructor as well. I was really flabbergasted to see the ERROR message "cannot distinguish a char from an int." This was in 1.2 so has this changed in 2.0? Your Lippman reference says specifically that you CAN overload by an argument of type char. -- David S. Angulo (312) 266-3134 Datalogics Internet: dsa@dlogics.com 441 W. Huron UUCP: ..!uunet!dlogics!dsa Chicago, Il. 60610 FAX: (312) 266-4473