Created
February 12, 2016 13:25
-
-
Save anonymous/432b25fad3e22970eb63 to your computer and use it in GitHub Desktop.
as3 calling overrided function super, makes function public
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import haxe.Log; | |
public class BaseTest { | |
public function BaseTest() : void { | |
} | |
protected function functionToOverride() : void { | |
(haxe.Log._trace)("BaseTest::functionToOverride",{ fileName : "Main.hx", lineNumber : 10, className : "BaseTest", methodName : "functionToOverride"}); | |
} | |
public function functionToOverride2() : void { | |
(haxe.Log._trace)("BaseTest::functionToOverride2",{ fileName : "Main.hx", lineNumber : 15, className : "BaseTest", methodName : "functionToOverride2"}); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
class BaseTest | |
{ | |
public function new(){ | |
} | |
function functionToOverride() | |
{ | |
trace("BaseTest::functionToOverride"); | |
} | |
function functionToOverride2() | |
{ | |
trace("BaseTest::functionToOverride2"); | |
} | |
} | |
class Test extends BaseTest | |
{ | |
public function new(){ | |
super(); | |
} | |
override function functionToOverride() | |
{ | |
trace("Test::functionToOverride"); | |
} | |
override function functionToOverride2() | |
{ | |
trace("Test::functionToOverride"); | |
super.functionToOverride2(); | |
} | |
public function doSomething() | |
{ | |
functionToOverride(); | |
functionToOverride2(); | |
} | |
} | |
class Main { | |
public static function main() | |
{ | |
var t = new Test(); | |
t.doSomething(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package { | |
import haxe.Log; | |
import flash.Boot; | |
public class Test extends BaseTest { | |
public function Test() : void { if( !flash.Boot.skip_constructor ) { | |
super(); | |
}} | |
protected override function functionToOverride() : void { | |
(haxe.Log._trace)("Test::functionToOverride",{ fileName : "Main.hx", lineNumber : 27, className : "Test", methodName : "functionToOverride"}); | |
} | |
protected override function functionToOverride2() : void { | |
(haxe.Log._trace)("Test::functionToOverride",{ fileName : "Main.hx", lineNumber : 32, className : "Test", methodName : "functionToOverride2"}); | |
super.functionToOverride2(); | |
} | |
public function doSomething() : void { | |
this.functionToOverride(); | |
this.functionToOverride2(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment