Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python calling method from constructor

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)
 
PREVIOUS NEXT
Tagged: #python #calling #method #constructor
ADD COMMENT
Topic
Name
4+4 =