摘要: 1. 纯虚函数形式 代码中的func1就是纯虚函数,没有函数体,没有函数的具体实现,有virtual,在函数名后面带有“ = 0”形式; 2.对于纯虚函数的注意事项 1.对含有纯虚函数的类,称为抽象类; 2.抽象类不能实例化,不能new; 3.纯虚函数被充当函数接口使用,函数的具体实现,在子类中实现 阅读全文
posted @ 2018-09-13 22:11 唯一诺 阅读(515) 评论(0) 推荐(0)
摘要: 1.空类所占字节数为1,可见代码如下 #include <iostream> using namespace std; class Parent { }; class Child:public Parent { public: int b ; }; int main(int argc, char* 阅读全文
posted @ 2018-09-13 20:38 唯一诺 阅读(5615) 评论(0) 推荐(2)