python classes examples pdf

Example 1: classes and objects in python ppt

class Class_name:
statement-1
.
.
statement-N

Example 2: classes and objects in python ppt

class employee:
 pass
 #no attributes and methods
 emp_1=employee()
 emp_2=employee()
 #instance variable can be created manually
 emp_1.first='aayushi'
 emp_1.last='Johari'
 emp_1.email='[email protected]'
 emp_1.pay=10000
 
emp_2.first='test'
 emp_2.last='abc'
 emp_2.email='[email protected]'
 emp_2.pay=10000
 print(emp_1.email)
 print(emp_2.email)