PHP topic for object-oriented programming (video tutorial) _php Tutorial

Source: Internet
Author: User
OO programming (Object Oriented programming, OOP, object-oriented programming) is a computer programming architecture, and one of the basic principles of OOP is that a computer program is composed of a single unit or object that can act as a subroutine, OOP achieves the three goals of software engineering: reusability, flexibility, and extensibility. To achieve the overall operation, each object can receive information, process data, and send information to other objects. Object-oriented has always been a hot topic in the field of software development, first of all, object-oriented conforms to the general law of human beings ' view of things. Secondly, the use of object-oriented method can make all parts of the system perform their duties and his ability. Opens the door for programmers to make their programming code simpler, easier to maintain, and more reusable. Some people say that PHP is not a true object-oriented language, which is true. PHP is a mixed language, you can use OOP, or you can use traditional procedural programming. However, for large projects, you might want to use pure OOP in PHP to declare classes, and use only objects and classes in your project. I'm not going to say much about this concept, because there are a lot of friends away from object-oriented programming is the main reason is a contact with the object-oriented concept when the understanding is not up, so do not want to learn. After reading the whole content of the reader, then go to the concept to understand it.

First video tutorial:
Bkjia Video Tutorial 17:php Study of object-oriented development (I.)
Bkjia Video Tutorial 18:php Study of object-oriented development (II.)
Bkjia Video Tutorial 19:php Study of object-oriented development (III.)
Bkjia Video Tutorial 20:php Learning for object-oriented development (IV)
Bkjia Video Tutorial 21:php Study of object-oriented development (V)
Bkjia Video Tutorial 22:php Learning for object-oriented development (VI)
Bkjia Video Tutorial 23:php Learning for object-oriented development (VII)
Bkjia Video Tutorial 24:php Learning for object-oriented development (eight)
Bkjia Video Tutorial 25:php Learning for object-oriented development (IX)
Instance:
Bkjia Video Tutorial 26: Making your own Php+mysql class

More relevant

=======================================================

Article directory:
1. Object-oriented concepts
2. What is a class, what is the relationship between the object, the class, and the object
3. What is object-oriented programming?
4. How do I abstract a class?
5. How do I instantiate an object?
6. How do I use Members in an object?
7. Use of special reference "$this"
8. Construction method and destructor method
9. Encapsulation
Application of four methods of 10.__set (), __get (), __isset (), __unset ()
11. Inheritance of Classes
12. polymorphic Applications
13. Overloading 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 Handling Call Errors
20. Auto-load Class
21. Serialization of objects
22. Abstract methods and abstract classes
23.PHP5 Interface Technology

=======================================================

2. What is a class, what is the relationship between the object, the class, and the object
Class Concept: A class is a collection of objects that have the same properties and services. It provides a unified, abstract description of all objects that belong to the class, including two main parts of properties and services. In an object-oriented programming language, a class is a stand-alone program unit that should have a class name and consist of two main parts: a property description and a service description.

Object concept: An object is an entity used to describe an objective thing in a system, which is a basic unit of a system. An object consists of a set of properties and a set of services that operate on that set of properties. From a more abstract point of view, an object is an abstraction of a problem domain or something in the implementation domain that reflects the information and the role that the thing needs to be saved in the system; it is a set of attributes and a wrapper for a set of services that have permission to manipulate these properties. The objective world is made up of the connections 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 of a class is the object, and the abstraction of a class object is the classes. Class describes a set of objects that have the same attributes (attributes) and the same behavior (methods). Above is probably their definition, perhaps you are just contact object-oriented friends, not to be confused by the concept of things, give you an example, if you go to Zhongguancun to buy a few assembled PC, to where you first step to do, is not installed engineers and you sit together, According to the information you provide with you to complete an installed configuration single Ah, this configuration can be imagined as a class, it is a piece of paper, but it is recorded on the PC you want to buy information, if you buy 10 machines with this configuration, then these 10 machines, are based on this configuration single, so that this 10 The machine is a type, it can be said to be a kind of. So what is the object, the instantiation of the class result is the object, with this configuration single configuration (instantiation) of the machine is the object, we can operate the entity, 10 machines, 10 objects. Each machine is independent, can only show that they are the same class, to one of the machines do any action will not affect the other 9 machines, but I modify the class, that is, in this configuration list with one or fewer accessories, then the installed 9 machines have changed, this is the relationship of the class object (class 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 to have a room, the room to have n computers, there are n tables, n chairs, white boards, projectors and so on, these are what, just now we said, this is the object, can see the entity, Can say this computer classroom unit is this one entity object, they together compose this computer classroom, then we are the procedure, this and object-oriented have what relation? Develop a system program and build a computer classroom. Similarly, you abstract each individual function module into a class, forming an object, composed of multiple objects that can receive information, process data, and send information to other objects, among other interactions. constitutes an object-oriented program.

4. How do I abstract a class?
As described above, the object-oriented program is the object, but the object is also through the instantiation of the class, so the first thing we have to do is how to declare the class, to make a class is very easy, as long as the basic rules of the program syntax can be done, then the difficulty is there? How many classes to use for a project, how many objects to use, where to define the class, what class to define, how many objects the class instantiates, how many properties there are in the class, how many methods are there, and so on, which requires the reader to design and summarize the actual problem analysis in the actual development. Definition of the class:

Class Name {
}

Use a keyword class and followed by a class name you want and a pair of curly braces, so that the structure of a class is defined, as long as you write code inside it, but what does it say? What can I write? How to write is a complete
What about the class? Above, the use of the class is to let it instance out of the object for us to use, it is necessary to know what you want to be the object, like the above we talk about a single installed on the list of what to write, you put out what the machine. For example, a person is an object, how do you recommend a person you are optimistic to your leadership? Of course, the more detailed the better: first, you will introduce the person's name, gender, age, height, weight, telephone, home address and so on. Then, you want to introduce what this person can do, can drive, speak English, can use computers and so on. As long as you introduce a little more, others to this person a little more understanding, this is our description of a person, and now we summarize, all objects we use class to describe are similar, from the description of the above can be seen, to make a class, from the definition of the angle of two parts, the first is static description, The second is the dynamic description, the static description is what we call the property, as we see above, the person's name, gender, age, height, weight, telephone, home address and so on. Dynamic is the function of this object, such as the person can drive, can speak English, can use the computer and so on, abstract Cheng Cheng

http://www.bkjia.com/PHPjc/486472.html www.bkjia.com true http://www.bkjia.com/PHPjc/486472.html techarticle OO Programming (Object Oriented programming, OOP, object-oriented programming) is a computer programming architecture, and one of the basic principles of OOP is that a computer program can be played by a single ...

  • Related Article

    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.