在這樣一個類:
CLabel& CLabel::SetTextColor(COLORREF crText)
{
m_crText = crText;
RedrawWindow();
return *this;
}
我如果將&去掉,寫為:CLabel CLabel::SetTextColor(COLORREF crText)
{
m_crText = crText;
RedrawWindow();
return *this;
}
兩者有什么區別嗎?
CLabel& CLabel::SetTextColor(COLORREF crText)
{
m_crText = crText;
RedrawWindow();
return *this;
}
我如果將&去掉,寫為:CLabel CLabel::SetTextColor(COLORREF crText)
{
m_crText = crText;
RedrawWindow();
return *this;
}
兩者有什么區別嗎?
而第二个的意思是说该函数返回类CLabel类型