It seems that a teacher has done something wrong. correct it. c ++ is too annoying.
I,
Which of the following statements about static data members is true?
A: static data members can be initialized in the class body.
B: static data members cannot be called by class objects.
C: static data members cannot be controlled by private controllers.
D: static data members can be called directly by class names.
Answer:
---------------------------------------
A: static data members can be initialized in the class body.
A: Yes.
I remember that only static and constant INTEGER (and compatible) data members can be initialized in the class body, for example:
Class coo
{
Public:
Static const int zero = 0; // OK
Static const double DZero = 0.0; // Some compilers are supported, but I remember
// The C ++ standard does not work. Maybe I remember it wrong.
Static int IIi = 1; // certainly not compiled: too many static data members are not allowed!
};
-------------------------------------------
B: static data members cannot be called by class objects.
A: Yes.
You can use an object to call static data members.
For example, you can:
Coo O;
Cout <O. Zero <Endl;
-------------------------------------------
C: static data members cannot be controlled by private controllers.
Error!
-------------------------------------------
D: static data members can be called directly by class names.
Yes. The only correct answer.
----------------------------------------
Ii. "basic question: when a derived class has multiple base classes, the instance of the derived class calls the constructor of the base class by () during initialization.
A: declare the order of these base classes
B: The order in which the list of constructors in the derived class appears
A: A is correct. B error.
That is, left to right. If the initialization order and parent class declaration order are incorrect, the compiler insists on generating calls in the order described by a and may give a warning.
III,
Which structure in STL is sequential storage ()
A: Map
B: Set
C: List
D: Vector
A: d. The Standard specifies that the element data stored in the vector must be continuously stored in the memory.
-------------------------------------
If you want to communicate with me, click the following link to become a friend:
Http://student.csdn.net/invite.php? U= 112600 & C = f635b3cf130f350c