Your experience on this site will be improved by allowing cookies
Python Constructors:
Python facilitates a special type of method, also called as Python Constructors, to initialize the instance members of the class and to verify enough object resources for executing any startup task.
Types of Constructors:
Features of Python Constructors:
Example:
class Employees(): def __init__(self, Name, Salary): self.Name = Name self.Salary = Salary def details(self): print "Employee Name : ", self.Name print "Employee Salary: ", self.Salary print "\n" first = Employees("Khush", 10000) second = Employees("Raam", 20000) third = Employees("Lav", 10000) fourth = Employees("Sita", 30000) fifth = Employees("Lucky", 50000) first.details() second.details() third.details() fourth.details() fifth.details() |
0 comments