📄 subject_42668.htm
字号:
<p>
序号:42668 发表者:wp 发表日期:2003-06-05 07:44:46
<br>主题:重载
<br>内容:我自己写了一个类 CPlugin<BR>它的成员变量有CString m_strUserName<BR> CString m_strSessionName;<BR><BR> CStringList m_strFileNameList;<BR>现在要重载=<BR>请问应该怎么写?<BR>急 谢谢了!
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:擎天柱 回复日期:2003-06-05 08:32:23
<br>内容:CPlugin& CPlugin::operator=(const CPlugin& rhs)<BR>{<BR> // ToDo: Add your specialized code here and/or call the base class<BR> if( this == &rhs )<BR> return *this;<BR><BR> m_strUserName = rhs.m_strUserName;<BR> m_strSessionName = rhs.m_strSessionName;<BR> <BR> // 自己写list的赋值吧!<BR> m_strFileNameList;<BR><BR> return *this;<BR>}
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:Neil Gan 回复日期:2003-06-05 08:44:50
<br>内容:if you only have these member variables, you don't need to write a operator= function yourself, vc will implement one for you that copy the members one by one, and it is perfectly ok for your class.
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -