Summary of knowledge points in C + + interview

Source: Internet
Author: User
Tags function prototype shallow copy
1. The advantages and disadvantages of the linked list and the sequential table, in what circumstances suitable for the order table, what occasions suitable for the linked list.
1 Sequential Table Storage
   principle: Sequential table storage is to put data elements into a continuous memory storage space, access efficiency, fast. But can not dynamically increase the length of the
   advantages: efficient access, through the subscript to store directly, access speed, through the subscript access
   disadvantage: A. Insert and delete slower, B. Cannot grow length    
   For example: when inserting or deleting an element, The entire table needs to traverse or move elements to rearrange the order
2 The principle of the list storage
   : The linked list storage is the dynamic allocation space in the program running process, as long as the memory still has space, will not occur the storage overflow problem
   Advantage: Inserts and deletes the speed quickly, retains the original physical order, For example: when inserting or deleting an element, simply change the pointer to point to the
   disadvantage: The search speed is slow, because the lookup, the need for circular link table Access
3 Application scenario: Frequent lookup but few insertions and deletions can be stored in sequential tables, If the frequent insertions and deletions are rare, the query can be stored using the linked list
2, what is the default parameter.
Defining the so-called default parameter, as the name suggests, is to specify a default value when declaring a parameter of a function, and you do not need to specify the parameter if the function is invoked when the default value is used. The main rule is the lack of
provincial parameters: You can only omit from the last argument when you call, in other words, if you omit an argument, you must omit all the arguments that follow it: the parameter with the default value must be placed at the end of the parameter table. The default value must be a constant. Obviously, this restricts the data types of the default parameters, such as the default parameter values for dynamic arrays and interface types, and for record types, which cannot be used as default parameters at all. Nil The default parameter must be passed by a value parameter or a constant parameter. A declaration is a function with a default parameter, the default value can only be written in the declaration.

1. If the function already has a function prototype declaration with a default parameter, the default value is not allowed in the definition of the function.
2. Once you specify a default value for a parameter of a function, you must also define default values for subsequent parameters, and define default parameters from right to left.
        void ShowMessage (char *text,int length=1,int color);//Wrong color should also define default values.
3. When calling a function, if you omit a parameter pass, all subsequent parameter passes are omitted, and arguments are passed from left to right to the row parameter when invoked.
       showmessage ("Hello");
       ShowMessage ("Hello", 5);
       ShowMessage ("Hello", 5,8);
       ShowMessage ("Hello",, 8);          Error

5, what is the reference. What is the effect of the reference. What is the difference between a reference and a pointer.
6, what is the function overload, function overload bottom is how to achieve. Why the function overload is not supported in the C language. What does an extern "C" mean?
7. List common function calling conventions.
8, what namespace. What's the use of it.

9, what is the structure body. How the structure is aligned in memory. What is the function of the structure.
10, what is the difference between classes and structs in C + +. What is the difference between structure in C language and C + + structure?
11, write a function: Gets the offset of a member in the structure body relative to the starting position of the structure
12, what is a class. How to define a class. C + + has several access qualifiers. Three main features of C + +. What is encapsulation.
13, C + + has several scopes. What is the difference.
14, what is the size of the empty class? Why.

15, what is this pointer. What attributes the this pointer has. C + + is how to bind member functions and objects together.
16, what is the constructor. The function of the constructor. What is the feature of the constructor. At what time is called. What is the default constructor. Under what circumstances will the compiler synthesize the default default constructor. Suppose the constructor is already defined in the class. Will the compiler still be synthesized?
17, what is the initialization list. How the data members in the class are initialized. Those data members must be initialized in the initialization list of the class. Why.
18, explicit keyword is what meaning.
19, what is the copy constructor. When the copy constructor was invoked. Why the parameters of a copy constructor must be a reference. What happens if it's not a reference.
20, what is a destructor, what is the characteristics of destructors. When did it fall out of use.
21, what is operator overloading. What are the characteristics of operator overloading. Those operators cannot be overloaded. How to overload the = and <<, >> operators. What to pay attention to when overloading an operator. [], –>, forward + + and post + + overload
22, what is friends, friends have what characteristics. The pros and cons of friends.
23, what is the static members of the class. Static data members will not be evaluated in the size of the object. What's the nature of it. Can you call non-static member functions in a static member function? Static member functions can be called in non-static member functions. Why.
24. What is the difference between the Const in C/A + +? What it does when Const modifies a member function of a class. Can you modify the constructor of a class? Can you modify a normal global function? The const object can call non-const member functions and const member functions. Non-const objects can call const member functions and non-const member functions. The const member function can call non-const and const member functions. Non-const member functions can invoke const and non-const member functions. Why?
25, what is the introverted function. What are the advantages and disadvantages of the introverted function. What is the difference between an introverted function and a macro function? Since the macro is flawed why C + + does not remove macros.

26, talk about C language memory management, C + + memory management, the difference between malloc/realloc/calloc. The difference between Malloc/free and New/delete new[]/delete[]?

27, what is operator new,new operator and positioning expression. Positioning expressions are generally used.
28, what is a deep copy of the shallow copy. Give the string class ordinary version/compact version/reference count version three different ways of handling
29, what is inheritance. The difference between private, protected, and public three ways of inheriting. What is an assignment-compatible rule. What is is-a and what is has-a. The order in which constructors and destructors are called in the inheritance system. Whether friends and static members can be inherited. An object model that understands single inheritance, multiple inheritance, diamond inheritance, and diamond virtual inheritance

30, what is polymorphic. The realization principle of polymorphism. What is a virtual table, what does a virtual table do with it? How to implement a polymorphic call. What is dynamic binding and static binding. What are the advantages and disadvantages of polymorphism. What is overload, overwrite, override. Grasp the object model of single inheritance, multiple inheritance, Diamond inheritance and diamond virtual inheritance, and what is pure virtual function. What is an abstract class.
31, what is generic programming, function template concept, instantiation, template parameter deduction, template parameter list, function template overload, instantiation; class template, instantiation of class template, specificity and type extraction. What is a separate compilation of templates.

32, Auto_ptr, Scoped_ptr, shared_ptr difference. What is a circular reference to a smart pointer. Why customize the deletion, how to customize it.
33, write out C + + four types of transformation

34, what is the exception, the exception of the profile and capture, exception capture matching rules, anomaly specification

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.