Procedural programming and object-oriented programming
Object-oriented Programming (OOP) Features:
- Abstract
- Encapsulation and data hiding
- Polymorphic
- Inherited
- Reusability of code
Abstractions and classes
A class is a C + + tool that translates abstractions into user-defined types, which synthesize a concise package of data representation and manipulation of data.
Constructors and destructors for classes
Constructor: Same as class name
Destructor: ~ Class name
Object Initialization method:
ClassName Cn=classname (...); or classname cn (...);
If the member function of a class does not modify the calling object, it should be identified as a const type, such as: Void Show () const;
This pointer
The this pointer points to the calling object of the class. *this represents an object.
Class scope
The names defined in the class are scoped to the entire class.
A constant scoped to a class
Enum{k=19};int A[k]; static cons tint k=19;
Abstract data type
C + + Primer Plus Study: Tenth chapter