Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

Bad inheritance call position #65

Open
ghost opened this issue Apr 13, 2014 · 0 comments
Open

Bad inheritance call position #65

ghost opened this issue Apr 13, 2014 · 0 comments

Comments

@ghost
Copy link

ghost commented Apr 13, 2014

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'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants