First part of the preparatory knowledge first chapter
Question 1. What kind of guiding significance is these FAQs answered? A: The meaning is: explain the characteristics of the language, give guidance on how to properly use, and discuss issues through instance programs.
These FAQs can be divided into three categories: following the following narratives.
(1) FAQS answered, explains a language characteristic of a C , and explains how to use them correctly in the C program.
(2) FAQS answered, explains how appropriate use of certain C features. In such an answer, sometimes the discussion is disclosed for a single language characteristic, and sometimes the plurality of language features will be described. Multiple features are combined to make them easy to perform complex design to meet a variety of technologies and business requirements.
(3) FAQs' answer, revealing the problem of legal problems in actual programming. These issues are caused by developers to develop hidden errors, difficult to understand, not easy to expand, high maintenance costs, lack of reuse software, will introduce what is the design and programming correct rules.
Question 1.7 What is the electronic version of FAQS? Since FAQS electronic version is free, why do you have to buy this book? A: The electronic version of FAQS was originally collected by Marshall Cline and published on the Internet, including a series of questions and answers about C . Now, the latest FAQs' electronic version is still updated and released by Marshall, you can go to the newsgroup comp.lang.c to download it. With the in-depth and accumulation of the problem, the Addison-Wesley Press finally plans to publish it in the form of a book.
This book has elaborated more themes than the electronic version of FAQs and discusses more deeper. This book provides a number of new examples for more in-depth instructions.
Most examples of examples are available, independent, own, have their own main () functions, and must-have #include files, and more. All examples of this book can be compiled and run directly.
Question 1.8 Why do you already have the first edition of this book, you still need to buy the second edition of this book?
A: Oh, because the technology is changing, and you want to keep up with it.
In recent years, there have been significant changes in object-oriented technology and C languages. A new language structure is generated, such as Running Type Identification (RTTI) and Namespace. Standard Template Library (STL) has become a knowledgeable knowledge that C must. Unified Modeling Language (UML) greatly promotes standardization of object-oriented design symbols. For each C developer, Java, Corba, and Activex are new hot knowledge that needs to be understood. The second edition of this book is to follow the first edition of this book, the form of organizational forms and concise styles that have been accepted, describe these new concepts and technologies to readers.
Finally, the second edition of this book is more complete than the first edition of the grammatical content telling the grammatical content, thanks to a large number of readers to make valuable suggestions and try to improve this book in various places.
What are the terms and conventions of this book?
A: Unpaped words inheritance indicate "public inheritance", private inheritance, private, or protected, inheritance.
Similarly, unselected terms derived class represents "Public Derived Class", expressed "private derived class" and "Protected Derived Class" by key derived classes. . Base and Derived are used as the assumed class name to represent the base class in the inheritance relationship and its (public) derived class.
OUT-LINED Function Description Function must be called via a CALL indicator. Conversely, when a Inlined function is called, the compiler is inserted into the target code of the function into it.
Remote Ownership is used when an object contains a pointer responsible for deleting itself. When the object has the Remote Ownership feature, the default destructor and copy are incorrect, so it is necessary to use Explicit to process.
The reader can modify the simplified description method used in this book, for example, we use "Using Namespace Std;" declare the use of standard libraries, this one-time introduction of the entire standard library is very convenient for users, but This approach is still an unstead of many people. Most authors are recommended to use the STD:: marker, reference the necessary types and names.
OO is an abbreviation for "Object-Oriented.".
Method is the meaning of the member function of the class.
Use 0 comparison using NULL to improve the readability of the code. The code specification should be considered before the reader is exercised.
The C programming language represents the ISO version of the C language.
At the end of the main () function, the compiler adds a default return value of 0.
BOOL type data is a built-in data type, contains both TRUE or FALSE values. That is, if your compiler is very unfortunate, there is no built-in BOOL type, and the following definition is added at the beginning of each example:
Typedef char bool;
Const bool false = 0;
Const Bool True = 1;
Expression new myclass, indicates that dynamically creates some type of MyClass object, assuming that internal deposits will throw exception instead of returning NULL. In addition to individual compilers, most compilers are implemented.
Most examples in this book use protected data members instead of private data members. In fact, this is reasonable for most developers and applications. However, the developers of the framework probably need to use the protected data member, because Protected data members increase the opportunity between the derived class and the base class. In short, the framework developer should use the Private data member, the protected member function.
The names of classes, structs, unions, enums, and Typedefs begin with a larger letter, the pre-treatment stroke is all uppercase letters, all other indicators begin with lowercase letters. Data member names and enumeration variables within the category are outside the end of the following horizontal lines.
The default C file extension is .CPP and .HPP, some other compilers have their own habits.
Use UML (Unified Modeling Language) symbols to express associations in your design.
The following factors are considered when selecting examples: (1) Single purpose. (2) Try to be simple. (3) Has a complete function. That is, each example will discuss a knowledge point or technical point, as short as possible, and it is a complete, runable program. However, these examples cannot be applied directly in the actual work, because in order to meet these factors, reducing the reuse of the program. In order to avoid the complex discussion of the Virtual member function, the Virtual member function is often used when it is not necessary when looking for the best balance using the Virtual and the INLINE member functions. In order to achieve a concise effect, many member functions are directly defined in the class's declaration, and even use the Inline flag to indicate these member functions and put them after the class's declaration (see problem 6.05). Uncailed functions usually do not define it, some functions may be undefined even if they are called, because the simple example of our principle is more important than a complete example. Also for the concise program, the example program does not provide pre-processors, and there is no scalability (see problem 2.16).
The example program typically places the public portion at the beginning of the class declare, rather than placing other locations. The benefits of doing this are the methods provided by those who use classes, but for those who modify classes, this approach is not necessarily very good. Usually people who use classes are always more than modifying it, this practice takes this factor.
This book will assume that your C compiler and standard library are standard and work properly. But in fact, they have not assumed it, you have to be more careful. :)