C++ 面试问题准备1

先看问题:在后面的文章中会给出答案:|)
Q: Is it possible to have Virtual Constructor? If yes, how? If not, Why not possible?

Q: What is constructor or ctor?

Q: What about Virtual Destructor?

Q: What is the difference between a copy constructor and an overloaded assignment operator?

Q: Can a constructor throws an exception? How to handle the error when the constructor fails?

Q: What is default constructor?

Q: What is copy constructor?

Q: When are copy constructors called?

Q: Can a copy constructor accept an object of the same class as parameter, instead of reference
of the object?

Q: What is conversion constructor?

Q:What is conversion operator?

Q: How can I handle a constructor that fails?

Q: How can I handle a destructor that fails?

Q: What is Virtual Destructor?

Q: Can a copy constructor accept an object of the same class as parameter, instead of reference
of the object?

Q: What's the order that local objects are destructed?

Q: What's the order that objects in an array are destructed?

Q: Can I overload the destructor for my class?

Q: Should I explicitly call a destructor on a local variable?

Q: OK, OK already; I won't explicitly call the destructor of a local; but how do I handle the above situation?

Q: What if I can't wrap the local in an artificial block?

Q: What is "placement new" and why would I use it?

Q: When I write a destructor, do I need to explicitly call the destructors for my member objects?

Q: When I write a derived class's destructor, do I need to explicitly call the destructor for my
base class?

Q: Is there any difference between List x; and List x();?

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容