巨人网络科技 一面

岗位:游戏服务器开发工程师 

4.27一面:

  1. class A {};,空类占几个字节?答:一个字节。追问为什么呢?。。class B { A a; };空类里面还有一个空类,占几个字节?如果再加一个虚函数,占几个字节?在加一个long类型的变量,占几个字节。(64位机器上)
  2. /2 和右移的区别
  3. map和unordered_map的区别,底层有什么不同。
  4. 说一下多态
  5. Mysql的存储引擎有哪些,分别有什么区别
  6. 说一下索引
  7. B+树和B树的区别
  8. 在多线程中执行的时候,是线程安全的嘛?为什么?
int getid() 
{ 
	static int i = 0;
	i++; return i; 
} 
  1. 输出什么?为什么?
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;
};
全部评论

相关推荐

评论
3
9
分享

创作者周榜

更多
牛客网
牛客企业服务