Adobe Flex Actionscript Question:

How polymorphism works on actionscript?

Tweet Share WhatsApp

Answer:

class UnpaidIntern extends Employee {
override public function receivePayment():Number {
return 0;
}
}

class Manager extends Employee {
override public function receivePayment():Number {
return baseSalary*3;
}
}

class Engineer extends Employee {
override public function receivePayment():Number {
return this.baseSalary*2;
}
}

class Employee {
internal var baseSalary:Number = 1000;
public function receivePayment():Number {
return this.baseSalary;
}
}

Download Adobe Flex Actionscript PDF Read All 84 Adobe Flex Actionscript Questions
Previous QuestionNext Question
What keyword allows you to refer to private variables of a class in flex?How do we overload functions in actionscript?