-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOOPs.py
99 lines (83 loc) · 2.08 KB
/
OOPs.py
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# class emp:
# def __init__(o,name,age): #used 'o' instead of self as the keyword
# o.x=name # we can give any varible for o.' '=name
# o.y=age
# def get(o):
# o.x=input("Name : ")
# o.y=input("Age : ")
# def give(o):
# print(o.x,'\n',o.y)
# obj=emp('','')
# obj.get()
# obj.give()
# same program
# class student:
# def __init__(self, name, age): #
# self.name = name ##--- initailization part
# self.age = age #
#
# def get(self): # get and put are function, we can give any name for those two
# self.name = input("Name : ") # getting inputs
# self.age = input("Age : ") #
#
# def put(self):
# print(self.name, '\n', self.age)
#
#
# z = student('', '') # object can be any variable name
# z.get()
# z.put()
# =============================================================
# class student:
# def __init__(self, name, age):
# self.name = name
# self.age = age
#
# def get(self):
# self.name = "Arun"
# self.age = "24"
# print(self.name, '\n', self.age) # we can print without creating a new function
#
# z = student('', '')
# z.get()
#----------------------------------------------------
# class com:
# def con(self):
# print("arun,athira")
# com1=com()
# com2=com()
# com.con(com1) # not using that oftenly
# com.con(com2)
#both are same ways
# com1.con()
# com2.con()
#----------------------------------------------------
# class com:
# def con(self):
# print("arun,athira")
# com1=com()
# com2=com()
#
# com1.con()
# com2.con()
#-------------------------------------------------------
# class computer:
# def __init__(self,ram,memory):
# self.ram=ram
# self.memory=memory
# def get(self):
#
# print('Ram is : ',self.ram,'& Memory is : ',self.memory)
#
# config=computer('8 GB ','1 TB')
# config2=computer('16 GB ','2 TB')
#
# config.get()
# config2.get()
#-----------------------------------------------------------
class memo:
def hi(self,n):
print('Hello',n)
x=memo()
ni=' Hi'
x.hi(ni)