Commit a1fd85bb authored by Adrian Buchholz's avatar Adrian Buchholz

Object Oriented Stuff

parent f44f2c1c
class Airplane:
numberofplanes = 3
def __init__(self, airline, model):
self.airline = airline
self.model = model
def whoosh(self):
print("WHOOSH")
american = Airplane("American", "A321")
print(american.model)
american.whoosh()
#Calling a Variable in a Class
print(Airplane.numberofplanes)
print(american.numberofplanes)
class Plane:
def __init__(self, name):
self.name = name
class Airbus(Plane):
def sound1(self):
print("VROOM")
class Boeing(Plane):
def sound2(self):
print("WOOSH")
airplane = Boeing("737-900")
print(airplane.name)
airplane.sound2()
class foo:
def method(self):
print("Foo method")
class foo1(foo):
def method1(self):
print("Foo1 method")
class foo2(foo1):
def method2(self):
print("Foo2 method")
foo = foo2()
foo.method()
foo.method1()
foo.method2()
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment