Several directions for C + + interview questions

Source: Internet
Author: User

1 Some important points about polymorphism and object-oriented
As an object-oriented programmer, this problem is to be clear, on-line, textbooks are standard answers, the key is to understand the connotation oh.

2 about virtual function tables and Rtti
This inside C + + Object model speaks fairly clearly
The first item of the virtual function table is about RTTI, and Rtti is the run time Type identification.
The following is the virtual function pointer item.

3 Memory layout for C + + objects
With the introduction of virtual functions, inheritance, multiple inheritance, virtual inheritance, and memory alignment, the problem is less simple.

4 constructors, destructors, and virtual functions
A series of questions, as a C + + programmer, this is important to understand.

5 Default parameter problems for virtual functions
Code estimates describe the problem more clearly:
Class A
{
Public
virtual void function (int type = 0) {...}
}

Class B:public A
{
Public
virtual void function (int type = 2) {...}//Note here the type default value is changed to 2
}
What's the problem with this change?
We know that virtual is dynamically bound, and for efficiency reasons, the default parameter is statically bound, so there is a problem with the above approach.
If you can use static binding and dynamic binding to explain the problem, then you go to a step, I have never used Ah, do not know the problem. There are articles that have not suffered the C + + programmer is not a good programmer, can not tame C + + This monster, this is not virtual!?

6 About Operators
Overloaded problems, operators, and functions

7 about the form of new and delete


8 about private inheritance
Do not know how many people have used, and how many benefits, and some language has been banned private inheritance, what is the meaning of entanglement?

9 about STL's iterator
STL has a lot of cow ideas, but I haven't been asked, like traits programming techniques and so on. An interview is common, with + + pre-and post-efficiency issues.

10 Exceptions to C + +
C + + has an exception handling mechanism, although not perfect, but still should be careful to understand.

11 about the efficiency of C + + and C
This problem is the most difficult to say, the efficiency of the comparison, what is the environment, what is the prerequisite, from the language level C + + C language to the main efficiency loss from the virtual caused by the non-direct call, this inside C + + Object model is quite clear.

Several directions for C + + interview questions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.