美文网首页
1_4参数传递

1_4参数传递

作者: hello萌面大婶 | 来源:发表于2018-01-02 22:29 被阅读0次

1.在常成员函数中,不可以修改类中任意数据成员

double real () const { return re; }       //注意在函数后面加const

2.参数传递----尽量传引用,速度比较快

pass by value

pass by reference(引用)

传引用不希望对象改,在前面加const

complex& operator += (const complex&);

相关文章

网友评论

      本文标题:1_4参数传递

      本文链接:https://www.haomeiwen.com/subject/zmoqnxtx.html