Created
November 26, 2014 20:13
-
-
Save gergob/c15ad1120f866edb714d to your computer and use it in GitHub Desktop.
Phone, Computer, SmartPhone classes implemented using multiple inheritance in Python 3.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Phone: | |
def __init__(self): | |
print("Phone constructor invoked.") | |
def call_number(self, phone_number): | |
print("Calling number {}".format(phone_number)) | |
class Computer: | |
def __init__(self): | |
print("Computer constructor invoked.") | |
def install_software(self, software): | |
print("Computer installing the {} software".format(software)) | |
class SmartPhone(Phone,Computer): | |
def __init__(self): | |
super().__init__() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment