Example 1 - Continued

Now we will use the classes we've defined by creating an instance of each class and exercising the methods. The expected output is shown on the next page.

var human = new Biped("human");
human.walk();

var owl = new Bird("owl");
owl.walk();
owl.fly();

var duck = new AquaticBird("duck");
duck.walk();
duck.fly();
duck.swim();

isInstance("human", "Biped");
isInstance("human", "Bird");
isInstance("human", "AquaticBird");
isInstance("owl", "Biped");
isInstance("owl", "Bird");
isInstance("owl", "AquaticBird");
isInstance("duck", "Biped");
isInstance("duck", "Bird");
isInstance("duck", "AquaticBird");