Click here to Skip to main content
15,905,558 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Critical Section problems... Pin
LukeV26-Oct-01 7:49
LukeV26-Oct-01 7:49 
GeneralRe: Critical Section problems... Pin
Joaquín M López Muñoz26-Oct-01 8:30
Joaquín M López Muñoz26-Oct-01 8:30 
GeneralRe: Critical Section problems... Pin
Tim Deveaux26-Oct-01 10:20
Tim Deveaux26-Oct-01 10:20 
GeneralRe: Critical Section problems... Pin
HintiFlo23-Jan-02 1:12
HintiFlo23-Jan-02 1:12 
QuestionHow to set a bitmap as a dialog background ? Pin
adara26-Oct-01 4:58
adara26-Oct-01 4:58 
AnswerRe: How to set a bitmap as a dialog background ? Pin
Joaquín M López Muñoz26-Oct-01 5:48
Joaquín M López Muñoz26-Oct-01 5:48 
Generalthanx Pin
adara26-Oct-01 12:19
adara26-Oct-01 12:19 
Generaloverload resolution in VC 6.0 Pin
Patrick D Owens26-Oct-01 4:46
Patrick D Owens26-Oct-01 4:46 
I have a PString class that derives from CString. In it, I overload the + operator so I can add a PString and long variable to give me a new PString. It works fine in VC 5.0, but while converting to VC 6.0, I get a C2666 error saying it cannot determine which overloaded + to use.
Here is the code segment:

PString strTemp1 = "abc";
long lTemp1 = 123;
PString strTemp2 = "def";
(1) strTemp2 = strTemp1 + strTemp2; // works fine.
(2) strTemp2 = strTemp1 + lTemp1; // C2666 error.
(3) strTemp2 = +(strTemp1, lTemp1); // no error.
(4) strTemp2 = ::operator +(strTemp1, lTemp1); // no err


class PString : public CString
{
public:
....
PCSGENRL_EXP_TYPE friend PString operator +( const PString& string1, const PString& string2 );
PCSGENRL_EXP_TYPE friend PString operator +( const PString& string, TCHAR ch );
PCSGENRL_EXP_TYPE friend PString operator +( TCHAR ch, const PString& string );
PCSGENRL_EXP_TYPE friend PString operator +( const PString& string, LPCTSTR lpsz );
PCSGENRL_EXP_TYPE friend PString operator +( LPCTSTR lpsz, const PString& string );

PCSGENRL_EXP_TYPE friend PString operator +(const PString& string,const long& value);
PCSGENRL_EXP_TYPE friend PString operator +(const long& value, const PString& string);
PCSGENRL_EXP_TYPE friend PString operator +(const PString& string,const double& value);
PCSGENRL_EXP_TYPE friend PString operator +(const double& value, const PString& string);
PCSGENRL_EXP_TYPE friend PString operator +(const PString& string,const int& value);
PCSGENRL_EXP_TYPE friend PString operator +(const int& value, const PString& string);
PCSGENRL_EXP_TYPE friend PString operator +(const PString& string, const ULONG& value);
PCSGENRL_EXP_TYPE friend PString operator +(const ULONG& value,const PString& string);

Why does line (2) give an error, while lines (3) and (4) give no compile error? Aren't they the same instruction?
Any help would be appreciated.



Pat
GeneralRe: overload resolution in VC 6.0 Pin
Chris Losinger26-Oct-01 4:55
professionalChris Losinger26-Oct-01 4:55 
GeneralRe: overload resolution in VC 6.0 Pin
Patrick D Owens26-Oct-01 5:16
Patrick D Owens26-Oct-01 5:16 
GeneralRe: overload resolution in VC 6.0 Pin
Joaquín M López Muñoz26-Oct-01 6:53
Joaquín M López Muñoz26-Oct-01 6:53 
GeneralRe: overload resolution in VC 6.0 Pin
Patrick D Owens26-Oct-01 9:16
Patrick D Owens26-Oct-01 9:16 
GeneralFilling CListCtrl from dll problem... Pin
26-Oct-01 4:39
suss26-Oct-01 4:39 
GeneralRe: Filling CListCtrl from dll problem... Pin
Joaquín M López Muñoz26-Oct-01 7:27
Joaquín M López Muñoz26-Oct-01 7:27 
GeneralAligning text Pin
Andrew Stampor26-Oct-01 3:57
Andrew Stampor26-Oct-01 3:57 
General2-d Graphics Pin
Chambers26-Oct-01 3:52
Chambers26-Oct-01 3:52 
GeneralRe: 2-d Graphics Pin
Remi Morin26-Oct-01 8:33
Remi Morin26-Oct-01 8:33 
GeneralRe: 2-d Graphics Pin
Christian Graus26-Oct-01 11:04
protectorChristian Graus26-Oct-01 11:04 
GeneralRe: 2-d Graphics Pin
Chambers27-Oct-01 0:07
Chambers27-Oct-01 0:07 
GeneralRe: 2-d Graphics Pin
Christian Graus27-Oct-01 0:32
protectorChristian Graus27-Oct-01 0:32 
GeneralON_UPDATE_COMMAND_UI problem... Pin
Remi Morin26-Oct-01 3:50
Remi Morin26-Oct-01 3:50 
GeneralRe: ON_UPDATE_COMMAND_UI problem... Pin
Tomasz Sowinski26-Oct-01 4:01
Tomasz Sowinski26-Oct-01 4:01 
GeneralRe: ON_UPDATE_COMMAND_UI problem... Pin
Chambers26-Oct-01 4:08
Chambers26-Oct-01 4:08 
GeneralRe: ON_UPDATE_COMMAND_UI problem... Pin
Carlos Antollini26-Oct-01 4:12
Carlos Antollini26-Oct-01 4:12 
GeneralRe: ON_UPDATE_COMMAND_UI problem... Pin
Carlos Antollini26-Oct-01 4:17
Carlos Antollini26-Oct-01 4:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.