programplug Logo




Python Inheritance


Object Oriented Programming provide a feature of inheritance.Inheritance is a process to create new class which acquires the properties of existing class with some changes.


class new_class_name(old_class_name):
statement 1
statement 2
statement 3

Python Inheritance Example

class One:   
	def a(self):  
	  print 'Hello...'  
class Second(One):     
   def b(self):  
	  print 'How Are You...'  
d=Second()  
d.b()  
d.a()  

output:
Hello...
How Are You...


Python Multilevel Inheritance

Multilevel inheritance is also possible in Python.

class First:   
	def a(self):  
	  print 'Hello...'  
class Second(First):  
   def b(self):  
	  print 'How Are You...'  
class Third(Second):  
	def c(self):  
		print 'Where Are You From...'  
d=Third()  
d.a()  
d.b()  
d.c()  

output:
Hello...
How Are You...
Where Are You From...


Python Multiple Inheritance

Python supports multiple inheritance too.






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