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
Mark Salsbery23-Feb-07 8:37
Mark Salsbery23-Feb-07 8:37 
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 
Hi

I am trying to pass by reference a variable. Below is the code.

In the class def I have
<br />
void				OnLoseFocusDate( Date &jdtDate);<br />



and in the src file I have
<br />
<br />
void CEQSLowerInterestLeg::OnLoseFocusDate(  Date &jdtDate)<br />
{<br />
    <br />
	if( jdtDate != Util::grdtNull)	<br />
	{<br />
		Date adjust_date( jdtDate );<br />
		const CCalendar *calendar = CHolidayMgr::GetInstance().GetEquityLegPaymentHoliday();<br />
		if (calendar)<br />
		{<br />
			adjust_date = calendar->BusinessDayIf(adjust_date, (EnBusDayConvention)m_jcmBDC.GetSelectedObjectID(), &ToolUtils::PromptForBusinessDay);<br />
		<br />
                        	jdtDate = adjust_date;<br />
		<br />
		}<br />
	}<br />
} // end of OnLoseFocusDate<br />
<br />



with the function call being

<br />
<br />
OnLoseFocusDate(m_jdtTerminationDate.GetValue());<br />
<br />

where GetValue()

is defined as

<br />
<br />
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 />
<br />

and m_value is defined as Date m_value;

The error I am getting is
<br />
<br />
error C2220: warning treated as error - no object file generated<br />
C:\viewstr\ptp6970-DateChange\Swaps\ptp\src\eqslowerinterestleg.cpp(2039) : warning C4239: nonstandard extension used : 'argument' : conversion from 'class Date' to 'class Date &'<br />
        A reference that is not to 'const' cannot be bound to a non-lvalue<br />


I dont understand why I get this error and I dont believe the solution is to pass in by const reference since I modify the argument in the function. Can someone please explain why I get this error and a solution?

I have found that if I do

<br />
Date xx = m_jdtTerminationDate.GetValue();<br />
OnLoseFocusDate(xx);<br />
<br />


then it is ok but I dont understand the difference between the 2 methods.

Many thanks !
AnswerRe: pass by reference error Pin
Cedric Moonen23-Feb-07 2:08
Cedric Moonen23-Feb-07 2:08 
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 

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.