Python ã® ã¯ã©ã¹(class)ã¯æ¬¡ã®ããã«å®ç¾©ãã¾ããã¯ã©ã¹åã¯æ £ç¿çã«å¤§æåã§å§ãã¾ãã class MyClass: """A simple example class""" # ä¸éã¯ã©ã¼ãã«ããã³ã¡ã³ã def __init__(self): # ã³ã³ã¹ãã©ã¯ã¿ self.name = "" def getName(self): # getName()ã¡ã½ãã return self.name def setName(self, name): # setName()ã¡ã½ãã self.name = name a = MyClass() # ã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ãçæ a.setName("Tanaka") # setName()ã¡ã½ãããã³ã¼ã« print(a.getName()) # getName()ã¡ã½ãããã³ã¼ã« ã¯ã©ã¹å®ç¾©ã®åé ã«ã¯ã"""...""" 㧠ããã¥
{{#tags}}- {{label}}
{{/tags}}