See the code
: The final output result. Please do not use ide to write down your answers and explain the reasons.
Package
{
Public Class
{
Public Function ()
{
}
Public Function Test (): void
{
Trace ("method of Class ");
}
}
}
Package
{
Public Class B extends
{
Public Function B ()
{
}
Override public function test (): void
{
Trace ("B class method ");
}
}
}
Package
{
Import flash. display. Sprite;
Import flash. Events. event;
Public class main extends Sprite
{
Public Function main (): void
{
VaR Ta: A = new B ();
Ta. Test ();
VaR TB: B = new B ();
Ta = Tb as;
Ta. Test ();
VaR TC: B = new B ();
Ta = a (TC );
Ta. Test ();
}
}
}
The answer should be:
Method B
Method B
Method B
I am wrong. The answer is:
Method B
Method of Class
Method B
As: if an object belongs to a type, as returns this object; otherwise, null is returned.
For example:
Trace (9 is number) // output: 9
Trace (9 as array) // output: NULL
Where
Ta = Tb as a; TB as a is a downward conversion method. If TB is a class, TB is returned. Otherwise, null is returned. TB as a is TB, so the second print should be: Class B Method