My understanding of object-oriented dark horse programmers

Source: Internet
Author: User

Since it is object-oriented, the most important concept is nothing more than an object. All the things we face are actually objects. An object has its intrinsic properties and inherent methods, in fact the object is composed of a collection of attributes and a collection of methods. This can be combined with Java understanding that objects in Java are instances of classes, and each class defines a series of properties and methods.

Then speaking of classes, this is also an important concept. class, very simple, is a collection of objects, not a specific collection, but an abstract description, and the description is the common properties and methods of such objects. In other words, commonality, very simple.

Object-oriented is one of the mainstream program design concepts and design norms, it replaces the early "structured" process design and development technology, the idea that everything is the object, the process of human thinking mode to solve problems. A program that targets a pair of images is made up of classes, each containing a specific part of the functionality exposed to the user and a hidden implementation section. Traditional structured programming solves problems by designing a series of processes (i.e. algorithms). Once these processes are identified, it is necessary to start thinking about how the data is stored, which clearly describes how the programmer works. But the face of the opposite is reversed in this order, it does not care about the specific implementation of data objects, as long as the user can meet the needs. Object-oriented has three most basic characteristics, namely: encapsulation, inheritance, polymorphism.

Encapsulation (encapsulation): Using the method to hide the data of the class, followed the basic concept of Java everything is the object and core ideas, to achieve the encapsulation of the class, so that the ordinary type to the object level; encapsulation controls the user's modification of the class and the degree of access to the data, enhancing the maintainability of the program.

Inheritance (Implementation): Occurs between classes and classes, can be divided into single inheritance and multi-layer inheritance describes the blood relationship between the parent and child objects, the ultimate goal is to: once inheritance is used, the subclass obtains all the members of the parent class (variables and methods), but the parent class's private methods and properties cannot be accessed. The final member of the parent class cannot be overridden. Once inheritance is used, an instance of the parent class can point to a reference to a derived class (subclass).

Polymorphism (Multipart): The two states that an object has at run time and compile time, which makes the code flexible and reusable. Compile-time polymorphism, that is, function overloading, the so-called function overloading refers to the same function name can correspond to multiple functions of the implementation of the specific call which according to the number of parameters, parameter type, etc. to determine. Run-time polymorphism: the ability to manipulate multiple derived types with a pointer or reference to a base class is called polymorphism.

The concept of classes and objects is an object-oriented foundation, with both of which we can already describe everything from abstraction to concrete, from time to space. There is also an object-oriented concept that emerges: abstraction. If you think the concept is simple, then it may be difficult to understand.

My understanding of object-oriented dark horse programmers

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.