, . , Bark() , Bark - , .
(, , ), bark(), , (. THING COMMAND? ( Bark bark())).
, :
BarkBehaviour
{
public function bark();
}
Bark BarkBehaviour
{
()
{ echo "\nWoof!";
}
}
an instance of your dog's barkBehaviour property will echo "Woof" because PHP considers the bark () method to be the constructor of the Bark class, which you did NOT intend this way. In JAVA, these things are case sensitive, so the Bark class constructor should be called Bark (), not bark ().
source
share