APS 非重点复习课程之高级语言程序设计
Data Type
1 | int aint; |
Pointer
A pointer holds the address of the other objects, and we can directly access the physical memory address of the pointed object by using pointer.
1 | int var_run=10; |
datatype of pointer p
must align with var_run
.
Function Overloading
1 |
|
OO
Features of Object-oriented⚠️
Encapsulation: the use of class 封装性
class contains data and method.
Inheritance: super class & sub-class reuse code 继承性
Polymorphism: reuse interface. 多态性
same interface, different methods.
1 | class A{ |
Constructor
Used to initialize the class so that we can give the data of the object an initial value.
- The name of constructor is the same as the class.
- have it’s own parameters just like normal functions.
- It’s auto executed during the creation of objects.
PO VS OO
procedure-oriented versus object-oriented
The most difference is that while procedural programming uses procedures to operate data on data structures, object-oriented programming bundles the two together, called an “object”, which is an instance of a class, operates on its “own” data structure.