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'); 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.) 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
Archived
This topic is now archived and is closed to further replies.