Skip to content

Instantly share code, notes, and snippets.

@eskrano
Last active August 29, 2015 14:25
Show Gist options
  • Save eskrano/69d5b9705e83d02c303a to your computer and use it in GitHub Desktop.
Save eskrano/69d5b9705e83d02c303a to your computer and use it in GitHub Desktop.
<?php
Class Animal
{
protected $name;
public function getName()
{
return $this->name;
}
}
Class Cat extends Animal
{
public function __construct($name)
{
$this->name = ucfirst($name);
}
public function meow()
{
return 'Cat '.$this->getName().' is saying meow';
}
}
$cat = new Cat('garfield');
echo $cat->getName();
echo '<br>';
echo $cat->meow();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment