Chapter 1 transition from C to C ++
It takes some time for everyone to get used to C ++. This process is especially distressing for programmers who are familiar with C. Because C is a subset of C ++, all C technologies can continue to be used, but many of them are not suitable for use. For example, C ++ Programmers think that pointers look odd. They will ask: Why don't we use pointer references instead?
C is a simple language. Only macros, pointers, structures, arrays, and functions are actually provided. Regardless of the problem, C relies on macros, pointers, structures, arrays, and functions. C ++ is not like this. Macros, pointers, structures, arrays, and functions certainly exist, in addition, there are private and protected members, function overloading, default parameters, constructor and destructor, custom operators, inline functions, references, friends, templates, exceptions, namespaces, and so on. C ++ has a wider space than C, because there are more choices to consider during design.
In the face of so many choices, many c programmers stick to their old habits. In general, this is not a great sin. However, some C habits are contrary to the spirit of C ++. They are all elaborated in the following terms.