ballhogjoni Posted October 23, 2008 Share Posted October 23, 2008 I have this class and want to return an instance of another class. The class name is in the code below: class Vendor_Interface_AutoSendVoucher extends Vendor_Interface_Abstract{ function getEmailLib(){ //my class name is Vendor_EmailLib_AutoSendVoucher return; } {/code] Link to comment https://forums.phpfreaks.com/topic/129863-solved-how-do-i-return-an-instance-of-a-class/ Share on other sites More sharing options...
ballhogjoni Posted October 23, 2008 Author Share Posted October 23, 2008 would this work function getEmailLib(){ ClassLoader::loadClass('Vendor_Interface_EmailLib_AutoSendVoucher'); return new Vendor_Interface_EmailLib_AutoSendVoucher(); } Link to comment https://forums.phpfreaks.com/topic/129863-solved-how-do-i-return-an-instance-of-a-class/#findComment-673261 Share on other sites More sharing options...
trq Posted October 23, 2008 Share Posted October 23, 2008 would this work function getEmailLib(){ ClassLoader::loadClass('Vendor_Interface_EmailLib_AutoSendVoucher'); return new Vendor_Interface_EmailLib_AutoSendVoucher(); } Yes. Link to comment https://forums.phpfreaks.com/topic/129863-solved-how-do-i-return-an-instance-of-a-class/#findComment-673268 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.