Python POOP: static, class methods

 https://www.youtube.com/watch?app=desktop&v=rq8cL2XMM5M


You want to create a method that applies to every instantiated object in class "Employee"

@classmethod  #keyword

def raise_everyone(cls, amount):

    cls.raise_amount = amount

To use:

Employee.raise_amount = 1.05

Comments

Popular posts from this blog

Python POOP: "name mangling"--how to make class data private or public (odd in Python!)

MAKING SOME POOP==Python classes constructor and instantiating; class variables