C++ 简单的语法上的介绍。 1. static One or more variables in a class can be declared static. In which case, only one instance of those variables exist, shared by all instances of the class. It must be initialised outside the class declaration : 2. const A class variable can also be constant. That's just like static, except it is given a value inside the class declaration and that value cannot be modified: 3. virtual method (If at least one of the methods of the base class is virtual then a "header" of 4 bytes is added to every instance of the classes. This allows the program to determine what a vector actually points to.) (4 bytes is probably implementation specific. On a 64 bit machine maybe it is 8 bytes...) |
|