rackm4am Posted January 23, 2008 Share Posted January 23, 2008 Please tell me what's the problem with this? class A{ ... } class B{ private a = new A; ... } it's not correct! i need to use class A instance inside of class B definition. ??? how would it be correct or what's the problem? Thank you all! Link to comment https://forums.phpfreaks.com/topic/87451-solved-php-class-instances/ Share on other sites More sharing options...
Barand Posted January 23, 2008 Share Posted January 23, 2008 try class B{ private $a; function __construct () { $this->a = new A; } } instead of trying to set it in the variable declaration Link to comment https://forums.phpfreaks.com/topic/87451-solved-php-class-instances/#findComment-447282 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.