June 2017
Beginner
352 pages
8h 39m
English
Now for the derived classes. We specify inheritance in Python using parentheses containing the base class name immediately after the class name in the class statement.
Here's the Airbus class:
class AirbusA319(Aircraft): def __init__(self, registration): self._registration = registration def registration(self): return self._registration def model(self): return "Airbus A319" def seating_plan(self): return range(1, 23), "ABCDEF"
And this is the Boeing class:
class Boeing777(Aircraft): def __init__(self, registration): self._registration = registration def registration(self): return self._registration def model(self): return "Boeing 777" def seating_plan(self): # For simplicity's sake, we ignore complex # seating arrangement ...
Read now
Unlock full access