php--Object-oriented summary (2014.5.19)

Source: Internet
Author: User

1: Object-oriented features:

(1): Abstract

(2): encapsulation

(3): Sharing

(4): Emphasizing object structure and not dying program structure

2: Three main features of object-oriented ( encapsulation, inheritance, polymorphism ) indispensable

    Encapsulation: is to encapsulate similar content into a class

Inheritance: The inheritance of family possessions

Polymorphic: Run-time loading

3: Initialize object:__construct (); The function will run automatically when the object is initialized

    Note : __ (This is two slide, be sure not to hit a yo)

If the initialization has parameters, the output must be followed by the

4: Package keyword: public,protected,private

Public: It is public.

5: Encapsulate related functions: __set (), __get ()

__set (): Gets the current class that encapsulates a private property or method re-execution or assignment operation

__get (): Gets the property or method encapsulated in the current class and converted to a common property

6: $this keyword in an object

$this keyword is a system variable that is used to access object properties and Object methods in the current object

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.