Skip to content

Instantly share code, notes, and snippets.

@iammerrick
Created April 5, 2011 01:09
Show Gist options
  • Save iammerrick/902818 to your computer and use it in GitHub Desktop.
Save iammerrick/902818 to your computer and use it in GitHub Desktop.
<?php
class Awesome_Functionality{
protected $_awesome;
public function awesomeify(){
echo $this->_awesome.' is awesome.';
}
}
class Awesome extends Awesome_Functionality{} // This is in kohana
new Awesome(); // returns Awesome
// Wait I want my own special type of awesome but I don't want to lose any functionality in the core awesome.
class Awesome extends Awesome_Functionality{
public function awesomeify(){
echo $this->_awesome.' is more awesome';
}
}
new Awesome(); // returns Awesome but the functionality has changed. This way you can use the exact class name Awesome but its your own inherited version. Simple but powerful eh?
new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment