class C{
...
public: friend C operator + (C&, C&);
...
};
C operator + (C& C1, C& C2){
....
}My question:
why use C& as parameter? Can I use ...operator + (C,C)?
...
public: friend C operator + (C&, C&);
...
};
C operator + (C& C1, C& C2){
....
}My question:
why use C& as parameter? Can I use ...operator + (C,C)?
C仅仅表示一个类的抽象概念,没有实例,如何使用。
在c比较巨大只是会增加程序的开销
C(const C & ins);operator(C&,C&)只把参数的地址压入stack,开销很小。所以应当使用operator(C&,C&)。