Class Object
Posted: Mon Jul 24, 2006 11:38 pm
I have few questions regarding the Class object in PHP :
1. is there a way to restrict the creation of class object only from particular other class object ? so, the user won't be permitted to explicitly create object by issuing NEW object() from main script.
User can only get the object by this way :
$myobj=$parobj->create_obj();
2. I made some object initialization via constructor function, whereby the constructor will possibly return TRUE or FALSE condition. I wonder how to check the result value returned by constructor function ?(without calling this constructor manually).
thanks.
1. is there a way to restrict the creation of class object only from particular other class object ? so, the user won't be permitted to explicitly create object by issuing NEW object() from main script.
User can only get the object by this way :
$myobj=$parobj->create_obj();
2. I made some object initialization via constructor function, whereby the constructor will possibly return TRUE or FALSE condition. I wonder how to check the result value returned by constructor function ?(without calling this constructor manually).
thanks.