MCPcopy Create free account
hub / github.com/CodeWithHarry/The-Ultimate-Python-Course / Employee

Class Employee

Chapter 10/04_constructor.py:1–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class Employee:
2 language = "Python" # This is a class attribute
3 salary = 1200000
4
5 def __init__(self, name, salary, language): # dunder method which is automatically called
6 self.name = name
7 self.salary = salary
8 self.language = language
9 print("I am creating an object")
10
11
12 def getInfo(self):
13 print(f"The language is {self.language}. The salary is {self.salary}")
14
15 @staticmethod
16 def greet():
17 print("Good morning")
18
19
20harry = Employee("Harry", 1300000, "JavaScript")

Callers 1

04_constructor.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected