All clasings in C are public, those who are different from Java in the same class is a private member who can access the same type object.
The constructor is initialized: (Do not write this in the header file) Person :: Person (): Name ("jack"), agn (30) {
...
}
Initialization before the function definition
Define objects in a partial function, assigning a heap space, must delete the Deconstructor that calls the object returns an object in the function, it is best to use the target or the object created by the global object or the heap space. If it is a local object, it is COPY light a () It is equivalent to the constructor that calls A, is used to construct a temporary object. Two creation class objects are different 1. First construct, in assigning A a a; a = a ();
2. Only the configuration of the A object, the following assignment statement does not make any meaning, not related operations A = a (); if the generated array object, the constructor called by each array variable is not the same, then the last Deconstructor is similar to this method: delete [] a;
The Protect modifier can be used inside, which can be used inside the quilt class to use inheritance inheritance, and can be operated by the method, and can be operated by way, actually existing in memory, only internal classes, external unable to perform direct calls
When inheriting in C , it can be modified according to the modifier, so that the visibility of the subclass is different.
A method of implying the parent class in the C subclass can be accessed with Namespace.
Derived class uses the USING method to solve the above problem, using and solve the function of the parent class function overload
When the object is generated, if the parent class covers the default constructor, the subclass must call the coverage of the parent class, otherwise the parent class constructor cannot be called, then the sub-class object cannot be generated.
Object pointer conversion, if Down Casting will appear Narrow phenomenon, the conversion may not succeed
As long as there is a function in the class being a virtual function, its destructor must be modified as a virtual function!
If the design is derived, it is best to write a Virtual function.
Remote the function of the parent class in the subclass, but do not allow the return value type to change!
The pure virtual function wants to be abstract classes in Java, as well as interfaces
C If inheriting an abstract class, but does not implement all functions, change the object.
The derived class is finally inherited in the public base class Class: Virtual public student, public teacher {
}
If the subclass needs to access the parent class, you need to add a namespace :: method
If the parameters incorporated in the class method are the parent class object that is changed, if the data member (Protect, Private) that is directly called to change the parent class is not allowed, if it is incoming, it is the object of the change itself. Can
Cout << is support buffer
FREAD / FWRITE is the function of the C language itself Read / Write is the function of the operating system.
Write in the Ostream class is binary
If the class is defined as Friend, the class can use all the data in its class, including the private data friend relationship, only in the class that is mutually declared, the relationship after the inheritance is not inherited from the friend of his parent class.
Friendly unlearable
The structure constant in the class must be assigned in the constructor, such as A (): a (0)
The normal function does not modify the status of data members in the class.
STATIC data can be used inside, but prerequisites must be performed outside
In the Static function, you cannot use Static's member variables, because when the object is not established, its member variables must not be generated.
Only Static const INT A = 100; it is not directly defined in the class, and the externally performs initialization is not initialized in any variable.
There is a default COPY constructor in C , but it is a shallow copy.
The default constructor is overloaded, and the basic class of the default constructor is completely overwritten.
Write the assignment operation overload, it is best to prevent yourself from assigning yourself, resulting in the error of the object itself, but the first judgment if (this == & s)
A O3 = O2; the execution is a copy constructor, because O3 has not yet established A O3; O3 has been established, so the last call is O3 = O2;
With const and non-Const parameters, the reason is that constants can be seen when a variable is seen, but it will not
Double-purpose operator template as a friend: T Operator (A & A1, A & A2)
A A & Operator () A A Operator (int Dummy) A Implementation {A * TMP = THIS; where data: A , B ; Return this;
}
ConstructOrDeconstructorCopy ConstructorOperator =
Operator = Only the member function is overloaded Operator [] can only be used in the multi-dimensional number of groups (10, 22)
"/": Site: (AC BD) / (C * C D * D) 虚 部: (BC-AD) / (C * C D * D) "*": Part: AC-BD虚 部: AD BC " ": Site: A C 虚 部: B D "-" Site: AC 虚部: BD
Simple method for object serialization, just convert the object to (char *) Write and read
{cin.peek () mean? cin.putback ()? then see cin.cc
}
Vector can use the subscript and use Iterator to traverse SET MAP frequently.
When you store an object in a Vector, the object must have a default constructor, support the copy constructor, support overload assignment operations.
If the key value can only be unique, you can use the set, and vice versa, you can use multiset
LowerBound only finds the first found setupperBound in Multiset to find the last founded setset in the multiset, and the former details of the VECTOR are discharged in order, the latter is all sorted, and the container is stored in the container to pay attention to space, such as: Vector > Template Template
The Static variable declared in the class must be initialized outside
{Queue and Vector, is a difference? What is the role of a big S before String? __box what role?
}
Map and Mulitmap, if you use Iterator, if you use p-> first, it is key, p-> second refers to Value.
The object stored in a container must have the correct copy constructor (if you want to have a deep copy, you have to rewrite it yourself, you have a default copy constructor), you must have a constructor of the parameters, and save it in a sorted container such as List In the middle, you must overload>, <, == operator java -cp target / classes: lib / jpox-enhance-1.0.3.jar: lib / jdo.jar: lib / jpox-1.0.3.jar: lib / LOG4J-1.2.8.jar: lib / bcel-5.1.jar org.jpox.enhance.jpoxenhancer target / class / org / jpox / tutorial / package.jdo