Single inheritance in python | Explain Single inheritance in python |

 


1)      Single Inheritance –

 

A child class inherits only a single parent class .



Single inheritance in python | Explain Single inheritance in python |


Single Inheritance 



 

Single Inheritance 

Program -


#single inheritance 

class parent:

def first(self):

print("First Function")

class child(parent):

def second(self):

print("Second Function")

ob = child()  # Object Created 

ob.second()

ob.first()






Output-


Second Function

First Function





Post a Comment

Post a Comment (0)

Previous Post Next Post