(a)
class Bird {
    method fly(){ ... }
}
class Plane {
    method fly() { ... }
}
class Angel {
    method fly(){ ... }
}
class Leaf {
    method fly(){ ... }
}


(b)
flyer = new Bird()
flyer.fly()

flyer = new Plane()
flyer.fly()

flyer = new Angel()
flyer.fly()

flyer = new Leaf()
flyer.fly()

Example 1: (a) Using these class definitions (in pseudocode), all of the method calls in Example 1(b) are valid.

Back to Article