📜  python 从构造函数调用方法 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:09.387000             🧑  作者: Mango

代码示例1
class TheBestClass:
  def __init__(self, num1, num2)
    self.number1 = num1
    self.number2 = num2
    self.AddTogether()   #call it within self.
    
  def AddTogether(self):
    print(self.number1 + self.number2)