Danack / PHP-to-Javascript

A tool for converting simple PHP objects/code to Javascript, so that code for manipulating objects can be used both server-side and client-side.
Other
104 stars 32 forks source link

Bad inheritance call position #65

Open ghost opened 10 years ago

ghost commented 10 years ago

inheritance is called on bad position.

php: class A{ public function foo(){echo('A')} } class B extends A{ public function foo(){echo('B')} } $test = new B(); $test->foo(); //echo 'B'

JS: function A(){ this.foo = function (){alert(('A')}; } function B() { this.foo = function (){alert( ('B')}; A.call(this); //foo is override by parent class. must be on beginning of class } var test = new B()); test.foo());//alert 'A'