mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 15:24:09 +03:00
add underscore to property (#2691)
property is exposed using setter and getters
This commit is contained in:
parent
c1d773eab7
commit
82c3ce4e8c
@ -665,7 +665,7 @@ class Human:
|
|||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
# Initialize property
|
# Initialize property
|
||||||
self.age = 0
|
self._age = 0
|
||||||
|
|
||||||
# An instance method. All methods take "self" as the first argument
|
# An instance method. All methods take "self" as the first argument
|
||||||
def say(self, msg):
|
def say(self, msg):
|
||||||
|
Loading…
Reference in New Issue
Block a user