Skip to content

Instantly share code, notes, and snippets.

@loisgh
Created December 23, 2022 22:11
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 loisgh/69249d6d4ed059c6fdf21997713dd662 to your computer and use it in GitHub Desktop.
Save loisgh/69249d6d4ed059c6fdf21997713dd662 to your computer and use it in GitHub Desktop.
class FirstClass():
myclass_variable = "Here is some data"
def method_one(self):
print("You are in FirstClass method_one")
def method_two(self):
print("You are in FirstClass method_two")
print("My Class Variable: {}".format(FirstClass.myclass_variable))
class SecondClass(FirstClass):
myclass_variable = "Here is some data from the SecondClass Method"
def method_one(self):
super().method_one()
print("You are in SecondClass method_one")
def method_two(self):
super().method_two()
print("You are in SecondClass method_two")
print("My Class Variable: {}".format(SecondClass.myclass_variable))
if __name__ == '__main__':
print("**********************************")
print("FROM THE FIRST CLASS METHOD")
print("**********************************")
FirstClass.myclass_variable
f = FirstClass()
f.method_one()
f.method_two()
print("**********************************")
print("FROM THE SECOND CLASS METHOD")
print("**********************************")
s = SecondClass()
s.method_one()
s.method_two()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment