What is polymorphism? (understanding of the meaning of downward transformation)
Professional perspective: multiple objects of the same kind have different reactions and effects when receiving the same message;
From the perspective of code form: the object variable of the parent class calls the method overridden in the subclass (Note: ther ...
Posted by cmgmyr on Sat, 15 Jan 2022 18:46:13 +0100
Features of static keyword:
1) Loads as the class loads
2) Priority object exists:
It cannot coexist with this (this: represents the address value reference of the current class object)
When the object does not have new, the member currently modified by static has memory
3) Statically modified
Can be shared by multiple obj ...
Posted by prawn_86 on Sat, 15 Jan 2022 18:25:57 +0100
1. Destructor cannot be overloaded
Reason: the destructor cannot be overloaded because it can only have one and cannot take parameters.
2. Why is the destructor of the base class a virtual function?
When implementing polymorphism, when the derived class is operated with the base class, the situation that only the base class is destructed ...
Posted by jaquito13 on Sat, 15 Jan 2022 12:37:23 +0100
1. Class polymorphism
Demand: teachers go to work by bike
Analysis: teachers, bicycles
Demand upgrade / iteration: Bicycle - > car
1. Create a Car class and write start and stop
2. Write open and close based on the original Teacher class
Note: violation of OCP principles
OCP - opening an ...
Posted by Dang on Mon, 03 Jan 2022 05:31:00 +0100
I hope you don't deliberately live in pursuit of a number. I hope you find the real valueYou must insist on being yourself, calm down and do what you like, and then give yourself to fate
Basic syntax of inheritance
When defining these classes, the members of the lower level have their own characteristics in addition to the co ...
Posted by mohvmark on Fri, 31 Dec 2021 07:07:16 +0100
ps: Learning Meet the crazy God My study notes
Process oriented & object oriented
Process oriented thought
The steps are clear and simple, what to do in the first step, what to do in the second stepFacing the process, it is suitable to deal with some relatively simple problems
Object oriented thought
Birds of a feather flock togeth ...
Posted by kiwiwilliam on Sun, 26 Dec 2021 02:40:27 +0100
Is the virtual function table a class? 1. The virtual function table belongs to a class, and all objects of the class share the virtual function table of this class. 2. The virtual function tables of different objects are the same (the first function address of the virtual function table is the same); 3. A pointer vptr pointing to the virtual f ...
Posted by varecha on Thu, 16 Dec 2021 21:43:27 +0100