I summarized the C problem set, you can also find the download of the PDF format in the following URL: http://www.designersky.com/upload/cpp_puzzle.pdf
1: C and C What is the difference: C supports object-oriented programming, and is compatible with C language-oriented programming
2: What is the difference between VB and C : VB is an object-based language, objects and classes concept, but for inheritance, polymorphism
3: What is the difference between VC and C : VC can be seen as a combination of C plus MFC underlying library
4: Declare a reference to what is needed, the function returns to the reference: 1 must notice what to declare the reference object 2 when defined the reference, the reference object 2 cannot reference the number, constant, and the expression function reference returns variable
5: What is the difference between reference and pointer: Pointer: You can point to different addresses (water-based popcorn) reference: Declaration, other variables can not be referenced (from one and final)
6: A constant reference and constant pointer difference: You cannot change the value of constant references to change the value of the constant pointer, but cannot change the point of constant pointer.
7: Differences and applications of default parameters and function overload: The default parameters can be seen as a special case of function overload, and the default parameters are canceled in Java. Application: The default parameters can cover normal applications and special applications, but if you want more flexible processing, you need to overload
8: Void add (int A, int b) and int Add (int A, int b, int c = 0) is whether it is the correct function overload: not, there is a possible existence
9: Void add (int A, int b) and Int add (const INT & A, Const Int & b) are correct function overload: not, integer reference is integrated
10: What is the use of inline functions, do you have inline functions before the function name is added to the INLINE key? : Uses: Save the overhead of calling functions, speeding up running speed, the compiler will automatically optimize
11: When will be used :: operator: an external implementation method, reference class static member, etc.
12: Static members and ordinary members: 1 Static member can directly reference 2 Static attributes can have the common feature of static member 4 static members in the initial value 3 static member.
13: Hold an example of using Static: The chain is a class, the store name property should be static (class class fee)
14: Constructor and destructuring function: Constructor is used to initialize the property, assign memory space for the pointer, and the destructor is used to release the assigned space.
15: New / Delete Operator and Malloc / Free Difference: 1 New / Delete is a C standard function, efficiency 2 NEW Auto-assigning Size, easy 3 new / delete will trigger constructive / destructor
16: Write an example of assigning 100 spaces for the INT type pointer, then reclaimed: int * p = new int [100]; delete [] P;
17: What is a shallow copy, what is deep copy: When the pointer properties are included, the shallow copy is only copied, and the deep copy is copied.
18: Write a class analog CIN and COUT: class mycout {public: mycout & operator << (int a) {printf (""% d "", a); return * this;}}
19: Describe the exception handling of C : TRY, CATCH model "
20: With the exception handling of VB, C is advantageous: C exception processing is divided into normal code and exception handling code, and more perfect in the throwing user-defined exception 21: 4 inheritance models in C : Single inheritance, multiple inheritance, level inheritance, multi-pole inheritance
22: If there is a similar method ABC in the class A, and C, how to reference: Immersib D, the method DA :: ABC () or DB: ABC (), DC :: ABC () The method of reference C
23: Subclasses will inherit all the contents of the parent class? : PRIVATE members will not be inherited
24: In the figure of the question 22, what is the order of constructive functions and destructuring functions after instantification of D's object? : A () -> b () -> c () -> d () -> ~ d () -> ~ c () -> ~ b () -> ~ a ()
25: If there is a parameter constructor in the parent class, it is generally necessary to provide a constructor without parameters, why? : Since the subclass is recycled during instantiation, the constructor in the parent class is called (unless the declaration of the parent class in the subclass), this is because there is a constructor in the parent class.
The translation will not generate the default constructor for the parent class, there will be an error.
26: What is Override, and what is the difference between overload? : Override: Function override, in the parent class and subclass, the source function declaration of subclass override functions and parent class must fully consistent overload: function overload, the overloaded set of functions must have different parameters
27: Can the parent class and sub-objects convert each other? : Is one-way, you can assign a sub-object to the parent class, or you can let the parent pointer point to the subclass, but cannot be reversed
28: What can I do? : Three phases can be realized by code reuse: 1 Copy Disadvantages 2 Modular Disadvantages: Not easy to maintain, expand 3 inheritance "
29: Is the parent class pointer to whether the method in the subclass is called after the child object? : Can't, unless the method in the parent class is declared as Virtual Note: Can't call the unique method in the subclass through the parent pointer
30: Different and application of virtual functions and pure virtual functions: Difference: Pure virtual functions generally do not implement application: The method is necessary to implement this method in the parent class, taking into account the polymorphism can be used with virtual functions, if there is no need to implement this method in the parent class However, it is expected to be implemented in subclasses, you can use pure virtual functions
31: Differences and Applications of Class and Abstract Class: Difference: Abstract class cannot instantiate objects, abstract class subclasses must overwrite pure virtual functions in the parent class: class is generally used to describe objects in reality, abstract classes Used to describe the concepts that do not exist in reality. Such as abstract class "shape" and "round" "
32: Subclass must overwrite (realize) the pure virtual function in the parent class? What about virtual functions? : Subcaters If the subclass cannot be enabled in the parent class, the number of objects cannot be instantiated, and it has become an abstract class. The virtual function is not overwritten.
33: What is the purpose of the false prevention function, an example? : The false preframe function can ensure that the destructor in the subclass can be called
34: Write a polymorphism: such as CPU products
35: Write a class factory: