First, Introduction
OO Programming---Object oriented programming, short: OOP, is a programming idea. OOP treats objects as a basic unit of a program, an object that contains functions for data and manipulating data. The appearance of object-oriented has greatly improved the efficiency of programming, and the reusability of programming is increased.
Python's Key object-oriented terminology:
1. Polymorphism (polymorphism): A function has multiple representations
2. Inherited (inheritance) subkeys inherit some of the functionality of the parent
3. Encapsulation (encapsulation) encapsulates functions or functions that need to be reused to facilitate direct invocation by other programs
4, class: A set of objects with the same data or method
5. Object: Object is a concrete case of a class
6, instantiation: is an object case of the implementation of the word
7. Identity: Each object's case requires a tag that uniquely identifies the case
8. Instance properties: An object is a collection of a set of properties
9, Case method: All Access or update an instance of an object one or more properties of the collection of functions.
10. Class Properties: Attributes that belong to all objects in a class.
11. Class Method:
II. classes and objects in Python
1 classPerson (object):2 def __init__(self,name):3Self.name =name4 Print "------>create:", name5 defSay_name (self):6 Print "My name is%s"%Self.name7 8P1 = Person ("GF1")9P2 = person ("GF2")Ten One P1.say_name () AP2.say_name ()
Output Result:
1 ------>create:gf12 ------>create:gf23 is GF1 4 is GF2
The above procedures are understood as follows:
1, constructs a class, and initializes,
Third, the inheritance in Python
Iv. methods and member variables
My understanding of Python object-oriented