9 key points that must be read in object-oriented _PHP tutorial

WBOY
Release: 2016-07-13 17:40:20
Original
1184 people have browsed it

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486231.htmlTechArticle1. Object-oriented elements 1. Abstraction, 2. Encapsulation, 3. Sharability, 4. Emphasis Object structure rather than program structure. The three major characteristics of object-oriented (encapsulation, inheritance, polymorphism) are indispensable...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!