Class and Object

Source: Internet
Author: User

Class and Object
Object Oriented (OO ).

At first, "object-oriented" refers to the use of encapsulation, inheritance, polymorphism and other design methods in program design. Now, the object-oriented thinking involves various aspects of software development. For example, object-oriented Analysis (OOA, ObjectOriented Analysis), object-oriented Design (OOD, Object Oriented Design), and object-oriented Programming implementation (OOP, Object Oriented Programming ).

Object and class explanation:

 

1) objects: objects are all things that people need to study. They not only represent specific things, but also abstract rules, plans, or events. An object has a state, and a data value is used to describe its State. The object also has operations to change the object state. The object and its operations are the behavior of the object. Objects combine data and operations to encapsulate data and operations in the unity of objects.

2) Class: objects with the same features (data elements) and behaviors (functions) are abstracted as classes. Therefore, the object is abstracted as a class, and the class is embodied as an object. It can also be said that the instance of the class is an object, and the class is actually a data type. A class has attributes. It is an abstraction of the object state and describes the attributes of a class using a data structure. The class has operations. It is the abstraction of the object's behavior. It is described by the Operation name and the method to implement this operation.

 

Relationship between objects and classes:

The relationship between a class and an object is like the relationship between a mold and a casting. The result of the strength of a class is an object, and the abstraction of an object is a class, class describes a group of objects with the same properties and behaviors.

 

 

[Php]View plain copy
  1. Class person {} // This is a class
  2. $ Obj = new person (); // class instantiation is an 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.