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! Quote 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 Quote Link to comment https://forums.phpfreaks.com/topic/87451-solved-php-class-instances/#findComment-447282 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.