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()"DAV")  

output:Constructor Example
Your School Name Is:DAV

Parameterized Constructor

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

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

Contact Us

Dehradun Uttarakhand India
Designed By : Mridul Gupta

Other Link

About Us

Contact Us


Privacy Policy