1

I don't understand when i use these three method separately. 1)instance method 2)class method 3)staticmethod

class CustomClass:

    # instance method
    def add_instance_method(self, a,b):
        return a + b

    # classmethod
    @classmethod
    def add_class_method(cls, a, b):
        return a + b

    # staticmethod
    @staticmethod
    def add_static_method(a, b):
        return a + b
Jay
  • 19
  • 1

0 Answers0