Invoking an Overridden Instance Method: super.methodName(arg1, arg2, ...argn);
class Rectangle {
protected var w = 0;
protected var h = 0;
public function setSize (newW, newH) {
w = newW;
h = newH;
}
public function getArea ( ) {
return w * h;
}
}
class ScreenRectangle extends Rectangle {
override public function setSize (newW, newH) {
super.setSize(newW, newH);
draw( );
}
public function draw ( ) {
}
}
class ReadOnlyRectangle extends Rectangle {
override public function setSize (newW, newH) {
}
}
Related examples in the same category