Object oriented technology of PHP

Source: Internet
Author: User
Tags abstract

1. Object-oriented concepts
2. What is a class, what is an object, the relationship between a class and an object
3. What is Object oriented programming?
4. How do I abstract a class?
5. How do I instantiate an object?
6. How to use the members of the object?
7. Use of special references to "$this"
8. Construction method and the method of destructor
9. Encapsulation of
Application of 10.__set (), __get (), __isset (), __unset () four methods
11. Inheritance of Classes
12. Multi-state application
13. Overload the New method
14. Type of Access
15. Use of static members
Application of 16.final Keywords
17.__tostring () method
18. Cloning objects
19.__call Processing Call Error
20. Auto Load Class
21. Serialization of objects
22. Abstract methods and abstract classes
23.PHP5 Interface Technology

1. Object-oriented Concepts
Object-oriented Programming (Object Oriented programming, OOP, object-oriented programming) is a computer programming
architecture, OOP A fundamental principle is that a computer program is composed of a single unit or object that can act as a subroutine, and OOP
achieves the three goals of software engineering: reusability, flexibility, and scalability. To achieve the overall operation, each object can receive
information, process data, and send information to other objects. Object-oriented has always been a popular topic in the field of software development, first of all, the
object-oriented accords with the general law of Human being's view of things. Secondly, the Object-oriented method can make all parts of the system perform their own duties and
as much as possible. Opens the door for programmers to make their programming code simpler, easier to maintain, and more resilient to
. Some people say that PHP is not a real object-oriented language, which is true. PHP is a hybrid language, you can make
use OOP, or you can use traditional procedural programming. However, for large projects, you might want to use pure OOP
to declare classes in PHP, and use objects and classes in your project. This concept I do not say much, because a lot of friends away from the face to
like programming is the main reason is a touch-oriented concept of the time to understand, so do not want to learn. Wait for the
person to read the whole article and then to understand the concept.
2. What is a class, what is an object, the relationship between a class and an Object
Class concept: A class is a collection of objects with the same properties and services. It provides an abstract description of the uniform
for all objects belonging to the class, including the two main parts of the property and service. In an object-oriented programming language, a class is a stand-alone
order unit that should have a class name and include a description of the property and two main parts of the description of the service.

Object concept: An object is an entity that is used to describe objective things in the system, which is a basic unit of the system. One
An object consists of a set of properties and a set of services that operate on this set of properties. From a more abstract point of view, the object is the problem domain or
An abstraction that implements something in a domain that reflects the information and the role it needs to preserve in the system; It is a group of
The encapsulation of a set of services that have the right to operate on these properties. The objective world is made up of the relationship between objects and objects.
The relationship between a class and an object is like the relationship between a mold and a casting, and the instantiation result of a class is an object, and the abstraction of one class of objects is
Class. Class describes a set of objects that have the same attributes (properties) and the same behavior (method).
The above is probably the definition of it, maybe you are just contact with object-oriented friends, do not be confused by the concept of things, give
For example, if you go to Zhongguancun and want to buy a few assembled PCs, where is your first step to do, is not installed
The engineer and you sit together, according to the information you provide with you to complete a installed configuration list, this configuration list can be
Like a class, it is a piece of paper, but it records the PC you want to buy information, if you use this configuration to buy 10 units
, then these 10 machines, are made up of this configuration list, so that the 10 machines is a type, it can be said to be
Class of. So what is an object, the instantiation result of the class is the object, configured with this configuration form (instantiated)
The machine is the object, we can operate the entity, 10 machines, 10 objects. Each machine is independent, only to explain
They are of the same class, and doing any action on one of the machines will not affect the other 9 machines, but I modify the class, which is
This configuration list with one or fewer accessories, then the installed 9 machines have changed, this is the relationship between class and object (class of
The instantiation result is the object).

3. What is Object oriented programming?
Do not say his concept, if you want to build a computer classroom, first of all to have a room, the room should have n computers,
There are n tables, n chairs, white boards, projectors and so on, what are these, we said just now, this is the object, can see
To the entity, it can be said that the computer classroom unit is this one entity object, they together constitute this
Computer classroom, then we are to do the program, this and the object-oriented what relationship?

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.