随笔分类 - c++
摘要:1、纯虚函数:类中函数声明为 virtual void foo() = 0;则此类不能实例化,为抽象类,子类若不实现纯虚函数,也不能实例化,继续为抽象类,直到实现父类所有纯虚函数为止。2、const后谁离const最近const就修饰谁const int a = 1; 或 int const a = 1; 都是修饰a,a为只读,且声明时必须初始化const int *a; 或 int const * a; const后为*,则表示修饰a指向的内容*a的值为readonlyint * const a; const后是a,则a的值为readonlyvoid foo() const; 表示foo..
阅读全文

浙公网安备 33010602011771号