#39 Class methods in python || Explained in 1 minute || DWARKA CODING CLUB
Автор: Dwarka Coding Club (DC2)
Загружено: 2022-10-19
Просмотров: 13
Описание:
This video explains the class methods in python
Complete playlist: • #1 Introduction to the 1-Min Python course...
=============================== Notes =====================================
class methods: they are used to manage the class data that can be shared by the whole class. "@classmethod" decorator is used to declare a method as a class method.
class Employee:
leaves = 12
bonus = 10000
@classmethod
def get_leaves(cls):
print(cls.leaves)
@classmethod
def get_bonus(cls):
print(cls.bonus)
obj1 = Employee()
obj1.get_leaves() # 12
obj1.get_bonus() # 10000
obj2 = Employee()
obj2.get_leaves() # 12
obj2.get_bonus() # 10000
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: