Skip to content

Instantly share code, notes, and snippets.

@pavanBS

pavanBS/A.php Secret

Last active June 28, 2017 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pavanBS/c04a91c76ae910367b264bee14f7b5c4 to your computer and use it in GitHub Desktop.
Save pavanBS/c04a91c76ae910367b264bee14f7b5c4 to your computer and use it in GitHub Desktop.
<?php
class A {
public function myage() {
return ' age is 80';
}
}
class B extends A {
public function mysonage() {
return ' age is 50';
}
}
class C extends B {
public function mygrandsonage() {
return 'age is 20';
}
public function myHistory() {
echo "Class A " .$this->myage();
echo "Class B ".$this-> mysonage();
echo "Class C " . $this->mygrandsonage();
}
}
$obj = new C();
$obj->myHistory();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment