Click here to Skip to main content
16,018,442 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why they are no Virtual Constructors. Pin
Maximilien23-Feb-07 8:44
Maximilien23-Feb-07 8:44 
AnswerRe: Why they are no Virtual Constructors. Pin
cmk23-Feb-07 12:38
cmk23-Feb-07 12:38 
GeneralRe: Why they are no Virtual Constructors. Pin
Bram van Kampen24-Feb-07 15:02
Bram van Kampen24-Feb-07 15:02 
GeneralRe: Why they are no Virtual Constructors. Pin
Rajesh R Subramanian25-Feb-07 21:46
professionalRajesh R Subramanian25-Feb-07 21:46 
QuestionA question about OpenGL picking Pin
jk chan23-Feb-07 2:21
jk chan23-Feb-07 2:21 
AnswerRe: A question about OpenGL picking Pin
El Corazon24-Feb-07 15:23
El Corazon24-Feb-07 15:23 
Questionpass by reference error Pin
minkowski23-Feb-07 1:57
minkowski23-Feb-07 1:57 
AnswerRe: pass by reference error Pin
Cedric Moonen23-Feb-07 2:08
Cedric Moonen23-Feb-07 2:08 
The problem is that when you return something from a function (for example your GetValue function), a copy of your object will be made (you don't return the object itself but a copy). So in your case, passing it by reference would mean that the function (OnLoseFocusDate) will probably want to modify it. But in your case it is totally useless because the object is lost after the function is called (so, the modifications are lost).

One way to do it is to return a reference to your object in the GetValue function:
Date& NewDate::GetValue(void)<br />
{<br />
if (::IsWindow(this->m_hWnd) && GetFocus() == this )<br />
{<br />
if( m_dateFormat == shortFormat )<br />
{<br />
SetError(!IsValid());<br />
}<br />
}<br />
<br />
return m_value;<br />
<br />
<br />
}<br />


But honnestly, I don't really find this very elegant...


Cédric Moonen
Software developer

Charting control [v1.1]

AnswerRe: pass by reference error Pin
Bram van Kampen24-Feb-07 15:12
Bram van Kampen24-Feb-07 15:12 
QuestionAbout CLSID??? Pin
siddharthsan23-Feb-07 1:49
siddharthsan23-Feb-07 1:49 
QuestionRe: About CLSID??? Pin
prasad_som23-Feb-07 6:01
prasad_som23-Feb-07 6:01 
QuestionGlobal hook Pin
tigger_am23-Feb-07 1:47
tigger_am23-Feb-07 1:47 
AnswerRe: Global hook Pin
PJ Arends23-Feb-07 10:05
professionalPJ Arends23-Feb-07 10:05 
Questionabout linking obj files Pin
sawerr23-Feb-07 0:52
sawerr23-Feb-07 0:52 
AnswerRe: about linking obj files Pin
toxcct23-Feb-07 0:56
toxcct23-Feb-07 0:56 
AnswerRe: about linking obj files Pin
Cedric Moonen23-Feb-07 0:57
Cedric Moonen23-Feb-07 0:57 
AnswerRe: about linking obj files Pin
Newbie0023-Feb-07 1:09
Newbie0023-Feb-07 1:09 
QuestionCReBar border question. Pin
PatrykDabrowski23-Feb-07 0:28
PatrykDabrowski23-Feb-07 0:28 
QuestionTrying to pass an array Pin
ericelysia22-Feb-07 23:57
ericelysia22-Feb-07 23:57 
AnswerRe: Trying to pass an array Pin
Cedric Moonen23-Feb-07 0:47
Cedric Moonen23-Feb-07 0:47 
AnswerRe: Trying to pass an array Pin
Newbie0023-Feb-07 0:59
Newbie0023-Feb-07 0:59 
QuestionVisual Studio Installer Error Pin
Mahesha_m22-Feb-07 23:42
Mahesha_m22-Feb-07 23:42 
QuestionVS2005 Pin
Anilkumar K V22-Feb-07 23:40
Anilkumar K V22-Feb-07 23:40 
AnswerRe: VS2005 Pin
Cedric Moonen22-Feb-07 23:51
Cedric Moonen22-Feb-07 23:51 
GeneralRe: VS2005 Pin
Anilkumar K V23-Feb-07 0:27
Anilkumar K V23-Feb-07 0:27 

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.