摘要:
为什么拷贝构造函数的参数必须是引用?(2011-10-12 17:31:21)转载▼例子:inline Account::Account( const Accout &rhs ): _balance( rhs._balance ){ _name = new char[strlen(rhs._name)+1 ]; strcpy(_name, rhs._name ); // 不能拷贝 rhs._acct_nmbr _acct_nmbr = get_unique_acct_nmbr();}int main(){Account acct2( acct1 );}问题:为什么拷贝构造函数Accou 阅读全文
posted @ 2013-07-30 17:12
jeans chen
阅读(457)
评论(0)
推荐(0)
摘要:
在小书C++中,4.2.2 派生类的构造函数和析构函数的构造规则(103页)在定义派生类对象时,构造函数执行顺序如下:基类的构造函数对象成员的构造函数派生类的构造函数。 阅读全文
posted @ 2013-07-30 16:00
jeans chen
阅读(157)
评论(0)
推荐(0)
摘要:
令operator=返回一个reference to *this 阅读全文
posted @ 2013-07-30 15:40
jeans chen
阅读(145)
评论(0)
推荐(0)
摘要:
阅读全文
posted @ 2013-07-30 10:31
jeans chen
阅读(171)
评论(0)
推荐(0)
摘要:
阅读全文
posted @ 2013-07-30 10:27
jeans chen
阅读(162)
评论(0)
推荐(0)
浙公网安备 33010602011771号