Created
April 5, 2011 01:09
-
-
Save iammerrick/902818 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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