e.g. below set class variable and instance attribute the same name to show the difference and look up order:


  • the attribute look up order: when request an attribute to an instance, it looks for that attribute in the instance first then in the class.

e.g. below how to access class variable in instance:

 

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。