We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4dd07cf commit 51746fbCopy full SHA for 51746fb
1 file changed
codes_in_Aug2025/OOPS/INHERITANCE/Inheritance.py
@@ -0,0 +1,19 @@
1
+class employee:
2
+ company = "Microsoft"
3
+ language = "Python"
4
+
5
+ def __init__(self, name):
6
+ self.name = name
7
8
+ def info(self):
9
+ print(f"The name of the employee is {self.name}. He is in the company: {self.company}, He uses the language: {self.language}")
10
11
+class programmer(employee): # Inherits from employee
12
+ company = "Google" # Overrides class variable
13
+ language = "Java"
14
15
+bob = employee("Bob")
16
+bob.info()
17
18
+alice = programmer("Alice")
19
+alice.info()
0 commit comments