-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdecorators(02).py
More file actions
53 lines (50 loc) · 1.06 KB
/
decorators(02).py
File metadata and controls
53 lines (50 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# '''abstractmethod'''
# from abc import abstractclassmethod , ABC
# class shape(ABC):
# @abstractclassmethod
# def area(self):
# pass
# class triangle(shape):
# def area(self,a,b):
# self.a=a
# self.b=b
# print(0.5*self.a*self.b)
# def m1(self):
# print("i am m1")
# # class rectange(shape):
# # def area(self,a,b):
# # self.a=a
# # self.b=b
# # print(self.a*self.b)
# # obj=rectange()
# # obj.area(90,10)
# obj=triangle()
# obj.area(2,5)
# obj.m1()
"""starticmethod"""
# class c1:
# data=90
# # def m1(self,a):
# # self.a=a
# @staticmethod
# def m1():
# a=10
# b=90
# c1.data=89
# print(c1.data)
# print("im m1 from startic")
# # print(self.a)
# obj=c1()
# obj.m1()
"""classmethod"""
'''class method is a method which is bound '''
class c1:
data=90
@classmethod
def m1(cls):
cls.a=100
cls.data=89
obj=c1()
obj.m1()
print(c1.data)
print(c1.a)