programplug Logo




Python Constructor


Constructor is a special type of method that is used to initialize the object.A constructor does not have any return type.
A constructor has a same name as the class in which it declare or use.Constructor can not be abstracted,static,final or synchronized.


Non Parameterized Constructor

class School:    
	def __init__(self):  
		print("Constructor Example")  
	def show(self,name):  
		print("Your School Name Is:",name)  
school = School()  
school.show("DAV")  

output:Constructor Example
Your School Name Is:DAV


Parameterized Constructor

class School:    
	def __init__(self, name):  
		print("Constructor Example")  
		self.name = name  
	def show(self):  
		print("Your Name Is :",self.name)  
school = School("Rahul")  
school.show()    

output:Constructor Example
Your Name Is :Rahul







Our Services

Developing Cheapest Websites
Offer Digital Marketing
Provide College Projects
Attractive Website Developing
Summer Training,Industrial Training
SCO,SMO

Contact Us

Dehradun Uttarakhand India
www.programplug.com
info@programplug.com
08534019974
Designed By : Mridul Gupta

Other Link

About Us

Contact Us

Disclaimer

Privacy Policy