day 23 for members of nested classes and objects

1, members of the class? Variables, methods, properties

  Variable: 1, instance variables (field)

         2, class variables (static field)

  Method: 1, examples of method  

        2, static methods

@staticmethod static method, if the method does not require the use of encapsulated object values, then you can use the static method @staticmethod, in front of the function defined 
def display (a1, a2):

         3, class methods @classmethod

  Properties: transformation out by methods

2, the difference between static methods, class methods and instance methods?

  Definition of when a static method, class method definitions need to add @, add an instance method does not require
  the implementation of static methods, class methods performed by the class can be called directly, instantiate an instance method first, and then through the object. Calling
  scenarios?
    If the relevant data will not be used within the method of the object, and can be static class
    Examples of the method if the object need to use
    if the code will be used in the current class, class methods can be used in order to save

3, attributes:

Summary property

4、

Guess you like

Origin www.cnblogs.com/xiaobai686/p/11747786.html