1、C 和 C++的区别
C面向过程
C面向对象,三大特点封装、继承、多态
封装性:隐藏对象属性和实现细节,仅对外提供公共的访问方式,代码模块化,代码重用
继承:扩展已存在的模块,代码重用
多态:接口重用,即一个接口,多种实现(不同实例对象调用相同的方法得到不同的行为)
2、虚析构函数
子类继承父类,基类的指针或引用指向派生类(A *p = new B),此时先调用基类构造函数,然后再调用子类的构造函数,当析构p时,会先调用B的析构函数,再调用A的析构函数。如果不是虚析构函数,程序只调用基类的析构函数,这样会导致内存泄露,造成系统崩溃。
#include <iostream>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <cstring>
using namespace std;
class A{
public:
A(){
cout << "constructor A" << endl;
}
virtual ~A(){
cout << "deconstructor A" << endl;
}
};
class B:public A{
public:
B(){
cout << "constructor B" << endl;
}
~B(){
cout << "deconstructor B" << endl;
}
};
int main(){
A *p = new B;
delete p;
}
3、hash_map扩容机制
https://blog.csdn.net/runrun117/article/details/80249556
https://www.jianshu.com/p/f6730d5784ad
4、strcpy 和 memcpy 的区别
https://www.cnblogs.com/stoneJin/archive/2011/09/16/2179248.html
5、僵尸进程、孤儿进程、守护进程
https://blog.csdn.net/gogokongyin/article/details/51340432
6、select、poll、epoll 区别
https://blog.csdn.net/shenya1314/article/details/73691088
https://blog.csdn.net/will130/article/details/51072819
7、static作用(修饰函数、局部变量、全局变量)
http://www.cnblogs.com/stoneJin/archive/2011/09/21/2183313.html
8、fork、vfork、clone
https://blog.csdn.net/gogokongyin/article/details/51178257
https://yq.aliyun.com/articles/48614
9、虚拟内存
https://blog.csdn.net/qq_30137611/article/details/66478426