| Introduction to OOP | Chapter 16: Overriding : | next | previous | audio | real | text |
class OSUAnchor extends Anchor {
public void printAnchor () {
print('//www.cs.orst.edu/');
inner;
}
}
class BuddAnchor extends OSUAnchor {
public void printAnchor () {
print('~budd/');
inner;
}
}
Anchor anAnchor = new BuddAnchor();
anAchor.printAnchor();
<A href=http:"//www.cs.orst.edu/~budd/">
Trace carefully the flow of control, and see how it differs from
replacement.