Click here to Skip to main content
15,896,730 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Is it me or is it the compiler? Pin
Ravi Bhavnani3-Oct-03 12:18
professionalRavi Bhavnani3-Oct-03 12:18 
AnswerRe: Is it me or is it the compiler? Pin
Michael Dunn3-Oct-03 13:06
sitebuilderMichael Dunn3-Oct-03 13:06 
GeneralRe: Is it me or is it the compiler? Pin
Ravi Bhavnani3-Oct-03 13:17
professionalRavi Bhavnani3-Oct-03 13:17 
GeneralRe: Is it me or is it the compiler? Pin
Michael Dunn3-Oct-03 14:26
sitebuilderMichael Dunn3-Oct-03 14:26 
GeneralRe: Is it me or is it the compiler? Pin
Ravi Bhavnani4-Oct-03 6:11
professionalRavi Bhavnani4-Oct-03 6:11 
GeneralRe: Is it me or is it the compiler? Pin
peterchen3-Oct-03 20:32
peterchen3-Oct-03 20:32 
GeneralRe: Is it me or is it the compiler? Pin
Ravi Bhavnani4-Oct-03 6:13
professionalRavi Bhavnani4-Oct-03 6:13 
GeneralWeird VC++ behaviour Pin
DaFrawg3-Oct-03 9:45
DaFrawg3-Oct-03 9:45 
While writing some code for a class, wich also contains oveloads for the assignment operator ( = ), VC++ keeps giving C2801 errors. According to MSDN, C2801 means that assignment, class member access, subscripting or function call operators must be a non-static class member.

This is my code:
class Foo<br />
{<br />
private:<br />
   CString m_String;<br />
public:<br />
   Foo();<br />
   Foo(CString);<br />
   ~Foo();<br />
   friend Foo& operator= (const class Bar);<br />
}<br />
<br />
Foo::Foo (CString string)<br />
{<br />
   m_String = string;<br />
}<br />
<br />
Foo& operator= (const class Bar BarInstance)<br />
{<br />
   return Foo (BarInstance.m_String);<br />
}<br />
<br />
class Bar<br />
{<br />
private:<br />
   CString m_String;<br />
public:<br />
   Bar();<br />
   ~Bar();<br />
}


But that's not the whole story; the code
char* yourName = "DaFrawg";<br />
MessageBox("Hello there, %s", yourName);

will generate a messagebox with the prompt "Hello there, %s" and the caption "DaFrawg". What I want is, of course, to have the message "Hello there, DaFrawg" displayed.

Can somebody help me, please?



//Please don't mind my bad English
GeneralRe: Weird VC++ behaviour Pin
Michael P Butler3-Oct-03 10:00
Michael P Butler3-Oct-03 10:00 
GeneralRe: Weird VC++ behaviour Pin
DaFrawg10-Oct-03 8:42
DaFrawg10-Oct-03 8:42 
GeneralRe: Weird VC++ behaviour Pin
Michael P Butler10-Oct-03 9:03
Michael P Butler10-Oct-03 9:03 
GeneralRe: Weird VC++ behaviour Pin
DaFrawg27-Oct-03 2:05
DaFrawg27-Oct-03 2:05 
GeneralRe: Weird VC++ behaviour Pin
David Crow3-Oct-03 10:07
David Crow3-Oct-03 10:07 
GeneralRe: Weird VC++ behaviour Pin
DaFrawg4-Oct-03 2:23
DaFrawg4-Oct-03 2:23 
GeneralRe: Weird VC++ behaviour Pin
David Crow6-Oct-03 2:59
David Crow6-Oct-03 2:59 
GeneralRe: Weird VC++ behaviour Pin
Mike Dimmick3-Oct-03 23:52
Mike Dimmick3-Oct-03 23:52 
GeneralRe: Weird VC++ behaviour Pin
DaFrawg27-Oct-03 2:00
DaFrawg27-Oct-03 2:00 
QuestionSDK creation (export of variables)? Pin
sjcomp3-Oct-03 9:25
sjcomp3-Oct-03 9:25 
AnswerRe: SDK creation (export of variables)? Pin
Peter Weyzen3-Oct-03 9:34
Peter Weyzen3-Oct-03 9:34 
GeneralRe: SDK creation (export of variables)? Pin
sjcomp3-Oct-03 9:45
sjcomp3-Oct-03 9:45 
GeneralRe: SDK creation (export of variables)? Pin
Peter Weyzen3-Oct-03 9:55
Peter Weyzen3-Oct-03 9:55 
GeneralRe: SDK creation (export of variables)? Pin
sjcomp3-Oct-03 10:06
sjcomp3-Oct-03 10:06 
GeneralRe: SDK creation (export of variables)? Pin
Peter Weyzen3-Oct-03 10:27
Peter Weyzen3-Oct-03 10:27 
GeneralRe: SDK creation (export of variables)? Pin
sjcomp3-Oct-03 10:41
sjcomp3-Oct-03 10:41 
GeneralRe: SDK creation (export of variables)? Pin
Peter Weyzen3-Oct-03 11:24
Peter Weyzen3-Oct-03 11:24 

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.