Click here to Skip to main content
15,921,990 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionAbout Word Addin of adding a bmp? Pin
sharkmouse5-Aug-05 3:14
sharkmouse5-Aug-05 3:14 
GeneralDynamic Arrays...... Pin
Raza56805-Aug-05 3:10
Raza56805-Aug-05 3:10 
GeneralRe: Dynamic Arrays...... Pin
ThatsAlok5-Aug-05 3:14
ThatsAlok5-Aug-05 3:14 
GeneralRe: Dynamic Arrays...... Pin
Bob Stanneveld5-Aug-05 3:44
Bob Stanneveld5-Aug-05 3:44 
GeneralRe: Dynamic Arrays...... Pin
Roland Pibinger5-Aug-05 8:43
Roland Pibinger5-Aug-05 8:43 
QuestionTo get message from Windows if user writes on hard disk? Pin
sannik5-Aug-05 2:07
sannik5-Aug-05 2:07 
AnswerRe: To get message from Windows if user writes on hard disk? Pin
koothkeeper5-Aug-05 3:24
professionalkoothkeeper5-Aug-05 3:24 
GeneralCPropertyPage's caption Pin
LiYS5-Aug-05 1:31
LiYS5-Aug-05 1:31 
GeneralRe: CPropertyPage's caption Pin
eli150219795-Aug-05 1:42
eli150219795-Aug-05 1:42 
GeneralRe: CPropertyPage's caption Pin
LiYS5-Aug-05 4:34
LiYS5-Aug-05 4:34 
GeneralRe: CPropertyPage's caption Pin
Marc Soleda5-Aug-05 4:47
Marc Soleda5-Aug-05 4:47 
GeneralRe: CPropertyPage's caption Pin
LiYS5-Aug-05 20:16
LiYS5-Aug-05 20:16 
GeneralRe: CPropertyPage's caption Pin
Marc Soleda7-Aug-05 20:42
Marc Soleda7-Aug-05 20:42 
QuestionHow to ignore the style of colspan of tablecells? Pin
123ivan1235-Aug-05 1:26
123ivan1235-Aug-05 1:26 
AnswerRe: How to ignore the style of colspan of tablecells? Pin
123ivan1236-Aug-05 21:33
123ivan1236-Aug-05 21:33 
GeneralProblem with OnPrint in MFC Pin
Puppet_5-Aug-05 0:17
Puppet_5-Aug-05 0:17 
GeneralRe: Problem with OnPrint in MFC Pin
Puppet_7-Aug-05 20:21
Puppet_7-Aug-05 20:21 
GeneralQuestions About CHtmlView and A Web Browsing Program Pin
jdnx5-Aug-05 0:17
jdnx5-Aug-05 0:17 
GeneralRe: Questions About CHtmlView and A Web Browsing Program Pin
jdnx6-Aug-05 1:31
jdnx6-Aug-05 1:31 
Generalk8062d.dll Pin
Member 20880665-Aug-05 0:10
Member 20880665-Aug-05 0:10 
GeneralRe: k8062d.dll Pin
Marc Soleda5-Aug-05 0:22
Marc Soleda5-Aug-05 0:22 
GeneralRe: k8062d.dll Pin
5-Aug-05 0:30
suss5-Aug-05 0:30 
GeneralRe: k8062d.dll Pin
eli150219795-Aug-05 1:48
eli150219795-Aug-05 1:48 
Generaltocxx... plz explain Pin
Eytukan5-Aug-05 0:08
Eytukan5-Aug-05 0:08 
GeneralRe: tocxx... plz explain Pin
toxcct5-Aug-05 0:23
toxcct5-Aug-05 0:23 
no, you didn't understand...

i said THIS won't work :

char* first  = "first";
char* second = "second";
CString str = first + second;


there is somewhere in the standard headers some operators defined, and especially two ones that are similar than the following :
const CString& operator + (LPCTSTR, const CString&);
const CString& operator + (const CString&, LPCTSTR);

so, for that to work, the operator must have one of its 2 operands of type CString.

let's expose what's going on what's going on when writing CString str = CString(first) + second;
1. Declaring <code>str </code>as a <code>CString </code>object.
2. seeing the <code>operator=()</code> the compiler evaluates the right part of the <code>=</code>
3. <code>CString(first)</code> call explicitely a constructor of the CString class that
     get a LPCTSTR (or <code>const char*</code> - it is the same).
4. seeing the <code>operator+()</code>, the compiler searches for an operator + that
     have the matching operand type (before trying an implicit cast). Happily, this
     operator + exist (see what i previously said on the global operators). it so calls is.
5. affects the CString that result from the + operation into <code>str</code>


understand better now, or may i have to explain what's going on too when using + between 2 char* ?



TOXCCT >>> GEII power
[toxcct][VisualCalc]

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.