Object-oriented Python

Source: Internet
Author: User
An introduction to object-oriented programming

OOP (object oriented programing) programming is the use of "classes" and "objects" to create various models to achieve a real-world description. Object-oriented can make the program more extensible and easy to modify,
Make our development more efficient. Object-oriented programs make it easier for people to understand your code logic and make team development easier

Nouns in object-oriented

Class: A class is an abstraction, Blueprint, prototype, template for a class of objects that have the same properties. The properties of these objects are defined in the class (variables (data)), common methods
Attributes: Human beings contain many characteristics, which are described by programs, called attributes, such as age, height, gender, name, etc. are called attributes, and a class can have multiple properties
Methods: Human beings not only have height, age, sex these attributes, but also can do a lot of things, such as talking, walking, eating and so on, compared to the attribute is a noun, talking, walking is a verb, these verbs are described by the procedure is called method.
Instance (object): An object is an instantiated instance of a class, a class must be instantiated before it can be called in the program, a class can instantiate multiple objects, each object can also have different properties, like human refers to everyone, each person refers to the specific object, people and people before there is a common, there are different
Instantiation: The process of turning a class into an object is called instantiation

Three major features in object-oriented

1 Encapsulation: Assignment of data in a class, internal invocation is transparent to external users, which makes the class into a capsule or container, in which the data and methods of the class are contained.
2 Inheritance: A class can derive subclasses, properties, methods defined in the parent class, automatic quilt class inheritance
3 polymorphic: Polymorphism is an important feature of object-oriented, simple point: "An interface, a variety of implementations", refers to a base class derived from a different subclass, and each subclass inherits the same method name while the parent class method to do a different implementation, this is the same thing shows a variety of forms.

Object-oriented Python

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.