<?php
class A {
function foo() {
echo "foo1";
}
function bar() {
$this->foo();
}
}
class B {
function foo() {
echo "foo2";
}
}
$a = new A();
$b = new B();
$a->bar();
$b->bar();
foo1
Fatal error: Uncaught Error: Call to undefined method B::bar() in /in/hhroO:23
Stack trace:
#0 {main}
thrown in /in/hhroO on line 23
Process exited with code 255.