You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.
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'
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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'
The text was updated successfully, but these errors were encountered: