1. Elements of object-oriented
1. Abstraction, 2. Encapsulation, 3. Sharability, 4. Emphasis on object structure rather than program structure
The three major characteristics of object-oriented (encapsulation, inheritance, Polymorphism) is indispensable
2. class MyPc{
public $name; —> Member attributes (can be understood as custom variables)
var $price;
function vod( ) { —>Member method (the amount can be a custom function)
return "bkJia video tutorial";
}
}
$pc1 = new MyPc(); —>Instantiation Class
$pc1->name; —>Use-> Access object content
3. OOp object Oriented Program Explanation: Program Wizard Development
4. $this keyword It is a system variable used to access object properties and object methods in the current object
5. Destructor: A method that can be automatically called when an object is released is called a destructor
6. Encapsulation keywords: public, protected, private
Encapsulation related functions: __set(), __get()
7. Public means global, and can be accessed by both internal and external subclasses of the class;
protected Indicates protected and can only be accessed by this class or subclass or parent class;
private means private and can only be used within this class;
8. Inheritance keyword: extends Single inheritance
9. Base class method overloading and parent class method access Overloaded method base class name:: Method name