Give an example that illustrates polymorphism in Flash Script.

Give an example that illustrates polymorphism in Flash Script.



The following script is an example that implements polymorphism in Flash Script:

- class Employee {
internal var baseSalary:Number = 101;
public function receiveWages():Number {
return this.baseSalary;
}
}
- class UnpaidIntern extends Employee {
override public function receiveWages():Number {
return 0;
}
}
- class Manager extends Employee {
override public function receiveWages():Number {
return baseSalary*3;
}
}
- class Engineer extends Employee {
override public function receiveWages():Number {
return this.baseSalary*2;
}
}
Post your comment