Created
October 2, 2011 07:23
-
-
Save lloc/1257185 to your computer and use it in GitHub Desktop.
Decorator Example Old
This file contains 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 Decorator { | |
var $_obj; | |
function Decorator ($obj) { | |
$this->_obj = $obj; | |
} | |
} | |
class PDecorator extends Decorator { | |
function repr () { | |
return '<p>' . $this->_obj->repr() . '</p>'; | |
} | |
} | |
class DivDecorator extends Decorator { | |
function repr () { | |
return ' <div>' . $this->_obj->repr() . '</div> '; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment