Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Diamond problem in PHP, showcasing the problem of multiple inheritance
<?php
class Cat {
public function roar() { /** Do Something **/ }
}
class Tiger extends Cat {
public function roar() { /** Do Something Different **/ }
}
class Lion extends Cat {
public function roar() { /** Do Something More Different **/ }
}
class Liger extends Lion, Tiger {}
// Create a new Liger
$liger = new Liger;
// Try to call the roar class
$liger->roar();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.