In the previous section we defined subclasses of
SC.Object that inherit functionality from their parent classes. However, inheritance is too rigid for sharing code among classes that may not directly inherit from a shared parent.
For instance, in a previous example we defined a
MyApp.Vehicle class and a
MyApp.Car subclass of it. The
MyApp.Car subclass added a
topSpeed property supposedly unique to cars, but of course,
topSpeed is not unique to cars. What if we had
MyApp.Helicopter, and other vehicle types? Some of these types will share common traits, such as top speed, but not all traits will be common to all vehicles, such as maximum altitude. How then would we subclass ...