I'm trying to learn inheritance concept in python. I have an Employee class and derivative class Executive.
class Employee:
'Class defined for employee'
def __init__(self, name, dept, salary):
self.name = name
self.dept = dept
self.salary = salary
Subclass
class Executive(Employee):
def __init__(self, name, dept, salary, hascar):
Employee.__init__(name, dept, salary)
self.hascar = hascar
has car is a Boolean passed into the constructor, However this will give me an error:
File "I:\Python_practicals\com\python\oop\Executive.py", line 7, in init Employee.init(name, dept, salary) TypeError: init() missing 1 required positional argument: 'salary'
When I try to Instantiate an object of Executive.
emp4 = Executive("Nirmal", "Accounting", 150000, True)