06 2012 档案

摘要:class A{public: A& operator += (const A&) {return *this;}; A& operator = (const A&) {return *this;};};class B:public A{public: B(){}; virtual ~B(){};};int main(){ A a; B b; b +=a; b = a; //invalid return 0;} 为什么 b += a;可以编译通过,但是b = a不行呢 ??因为operator =很特殊,即使你没有写,compiler也要生产一个,所以已经有一个 阅读全文
posted @ 2012-06-21 15:21 嗷嗷 阅读(799) 评论(0) 推荐(0) 编辑
摘要:#include <complex>#include <iostream>using namespace std;int main(void ){ complex< int> z(20, 200); cout << abs< int>(z) << endl; return 0;}According to the C++ ISO spec, §26.2/2:The effect of instantiating the templatecomplexfor any type other thanfloat,doub 阅读全文
posted @ 2012-06-20 09:30 嗷嗷 阅读(315) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示