Create an Abstract class to override default constructor in Python
Making the __init__ an abstract method
from abc import ABCMeta, abstractmethod class AbstractClass(object, metaclass=ABCMeta): @abstractmethod def __init__(self, n): self.n = n class Employee(AbstractClass): def __init__(self, salary, name): self.salary = salary self.name = name emp1 = Employee(10000, "John Doe") print(emp1.salary) print(emp1.name)
Sample output of above program.
10000 John Doe
2019-07-08T08:06:51+05:30
2019-07-08T08:06:51+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution