eLearning
Tutorials
Programs
Interview Questions
Technical Questions
C Language
C++
JAVA
HTML & CSS
PHP
AJAX
J2EE
SQL
jQuery
Go back to Home
Our Placements
Tutorials
Programs
Interview Questions
Technical Questions
Live Training
Our Placements
Associated Colleges
Our Recruiters
Back
C Language
C++
JAVA
HTML & CSS
PHP
AJAX
J2EE
SQL
jQuery
Programs
Home
Programs
Python
Inheritance
Programs - Python -
Inheritance
Program:
class
Animal
:
def
speak
(self)
:
print(
"Animal Speaking"
)
# child class Dog inherits the base class Animal
class
Dog
(Animal)
:
def
bark
(self)
:
print(
"dog barking"
)
d = Dog()
d.bark()
d.speak()
Output:
dog barking
Animal Speaking