Skip to content

Instantly share code, notes, and snippets.

@gergob
Created November 26, 2014 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gergob/c15ad1120f866edb714d to your computer and use it in GitHub Desktop.
Save gergob/c15ad1120f866edb714d to your computer and use it in GitHub Desktop.
Phone, Computer, SmartPhone classes implemented using multiple inheritance in Python 3.x
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