巨人网络科技 一面
岗位:游戏服务器开发工程师
4.27一面:
- class A {};,空类占几个字节?答:一个字节。追问为什么呢?。。class B { A a; };空类里面还有一个空类,占几个字节?如果再加一个虚函数,占几个字节?在加一个long类型的变量,占几个字节。(64位机器上)
- /2 和右移的区别
- map和unordered_map的区别,底层有什么不同。
- 说一下多态
- Mysql的存储引擎有哪些,分别有什么区别
- 说一下索引
- B+树和B树的区别
- 在多线程中执行的时候,是线程安全的嘛?为什么?
int getid() { static int i = 0; i++; return i; }
- 输出什么?为什么?
class Base { public: Base() { f(); } virtual void f() { cout << "Base::Base()" << endl; } }; class Derived : public Base { public: void f() override { cout << "Derived::Derived()" << endl; } }; int main() { Base* b = new Derived(); delete b; return 0; };