Object-oriented concepts

Source: Internet
Author: User
Tags definition class definition inheritance

The origin of 9.1.1 object-oriented technology

9.1.2 Basic Concepts

This can be said: "Object-oriented = object + class + inheritance + communication." "If a software system is designed and implemented using such four concepts, we think the software system is object-oriented."

Objects (object)

Object is the basic component of object-oriented development method. Each object can be defined by its own set of properties and a set of actions on it. An object can be a physical object in real life, or it can be an instance of a class of conceptual entities. For example, a car, a person, a book, or even a language, a graphic, a way of management, can be an object.

From the perspective of analysis and design, objects represent a concept that models the real-world entities involved. The relevant declarations of an entity are: Describe the entity, including the attributes of the entity and the actions that can be performed. For example, the object of the car, its weight, color can be used as the object's properties, it can perform the operation can be driven, whistle and so on.

Classes (Class)

A class is a set of objects that have the same data structure and the same operations. A class is an abstraction of a series of objects of the same nature, a description of the common characteristics of objects. For example, every car is an object, all cars can be used as a template, we define the car this class.

In a class, each object is an instance of a class, and you can use the methods provided in the class. Creating an object from a class definition must have an instance-setting operation, and the new operator in C + + and C # can be used to create an instance of a class, and C # is more secure for our approach.

Inheritance (inheritance)

Inheritance is the creation of newly defined techniques using existing definitions as the basis. The definition of the new class can be the data declared by the stored class and the combination of declarations added by the new class. New class reuse is the definition of existence and does not require modification of the stored class. A stored class can be referenced as a base class, and a new class can be referenced as a derived class. This reuse technology greatly reduces the cost of software development.

For example, the car as a class already exists, as a truck with its own characteristics can be inherited from the car class. Like the car, it has the characteristics of color and weight, it can drive and whistle. It also has a general car does not necessarily have characteristics, such as cargo can be loaded and so on.

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.