Understanding PHP Object-oriented

Source: Internet
Author: User

PHP three major features: encapsulation, inheritance, polymorphism, has been only know its word, but do not understand its meaning and specific use, but the inheritance has the approximate

The advantage is the reusability of the Code,
OOP concept, remember once I went to the interview, people asked me what is oop, and then I answered a lot of what inheritance, encapsulation, polymorphism, etc., and then I asked others

What is OOP, people say is object-oriented, then completely enlightened. Since objects are object-oriented, objects are instantiated from the class,

What is a class? Definition: The nature of the entity and the specific behavior, such as a person who has a name, a gender, he may be a soldier, may be a student, these

It is the behavior that he behaves, called the method in the procedure. Instantiate a specific object through a specific class.
Five scopes for attributes: Public,private,protected,static,final, six scopes of methods: public,protected,

Private,final,abstract,final. Constants are defined in a class by Const, property overloading methods, when a non-existent property is referenced in a class

is called when the __get __set.
Abstract class: Abstracted, declared in the parent class, implemented in subclasses, abstract classes cannot be instantiated and can only be inherited.
Final: Prevent quilt class coverage
Constructors and destructors: __construct,__destruct, in object creation and destruction, and in separate invocations;
Instanceof determine if an object is an instance of a class
Auto-load: __autoload, referencing a class that is not defined in the script, is automatically loaded

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.