friend istream& operator>>(istream &input,Complex &a){
input>>a.real>>a.imaginary;
return input;
};
friend ostream& operator<<(ostream &output,const Complex &a){
output<<a.real<<'+'<<a.imaginary<<'i'<<endl;
return output;
};
抽象类:有纯虚函数(必须重载
vtable:https://blog.youkuaiyun.com/primeprime/article/details/80776625
虚析构是为了调用子类的防止释放不完整
typeinfo typeid()
https://blog.youkuaiyun.com/w55100/article/details/80330812
static
static data member can be change by all way except const function.
static function only use static member
construct and de order
instance derive class use base constructor to initialize the base member
Base class constructors and assignment operators
class A{
B b;
C c;
}
con:b,c,a
de a,c,b
initialize list
class A{
const a;
A(int 1):a=i //can change const
{
}
}
动态链接就是编译到时候不知道,执行的时候才知道连接
https://blog.youkuaiyun.com/lz20120808/article/details/50461296
array
array1=array2 //no
array1==array2 //no
nochar array can’t be io at once
class_copy
’ =’ use copy constructor.
have default if you don’t create one,(default is shallow copy).
only one argument and it must be reference or infinite recursion.
prevent copy :
https://blog.youkuaiyun.com/weixin_42183514/article/details/83661208
cast operator functions
https://blog.youkuaiyun.com/qq_39025293/article/details/104435854
https://blog.youkuaiyun.com/michaelalan/article/details/16973925
inheritance
operator can be inherited
https://www.cnblogs.com/wkfvawl/p/10738409.html
"using " in inheritance
By default, each inherited constructor has the same access level (public, protected or private) as its corresponding base-class constructor.
d.If the derived class does not explicitly define constructors, the compiler generates a default constructor in the derived class—even if it inherits other constructors from its base class.
https://www.cnblogs.com/sssblog/p/10202601.html
Theoretically, clients do not need to see the source code of classes from which they derive other classes.
derived class vtable would not similar to base class, will receive a pointer to the virtual function of base class
The C++ compiler makes objects take up more space in memory if they have virtual function
using
https://www.cnblogs.com/wkfvawl/p/10738409.html
explicit constructor
exactly one argument
can’t type conversion
other
*(this).=this->
Run-time type information can be used to determine object type.
only my personally daily, maybe somethings is wrong