JREAM Posted May 18, 2011 Share Posted May 18, 2011 // way 1... (But im not sure how I can hold the errors inside the Blah class) everytime an item is called class Blah { public function __construct() { $this->slice = new Slice(); $this->thumb = new Thumb(); } } $blah = new Blah(); $blah->slice->file('test.jpg'); // Way 2 class Blah { public function __construct() { $this->_slice = new Slice(); $this->_thumb = new Thumb(); } public function slice($arg) { $this->_slice->{$arg[0]}($arg[1]) } public function thumb($arg) { $this->_thumb->{$arg[0]}($arg[1]) } } $blah = new Blah(); $blah->slice('file', 'test.jpg'); Quote Link to comment https://forums.phpfreaks.com/topic/236803-which-way-is-better-oop/ Share on other sites More sharing options...
pornophobic Posted May 18, 2011 Share Posted May 18, 2011 I'll just leave this here... Link (holding errors inside of blah. you will need to edit other classes as well, I imagine.) Quote Link to comment https://forums.phpfreaks.com/topic/236803-which-way-is-better-oop/#findComment-1217304 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.