Re: Is this behavior expected?
| From: | Jingcheng Zhang | Date: | Sun, 03 Oct 2010 06:19:42 +0000 |
| Subject: | Re: Is this behavior expected? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49843@lists.php.net to get a copy of this message | ||
Hi Stas,
Got it. Thanks for your detailed explanation :-)
2010/10/3 Stas Malyshev <smalyshev@sugarcrm.com>
> Hi!
>
>
> The result is "Fatal error: Class 'C' not found". Is this result expected?
>>
>
> Yes. Define your classes before using them, or use autoloading.
>
> Why?
>>
>
> (Highly technical details) Because C can't be early-bound on compile time
> due to the dependency on the interface and thus at the time of the call it's
> not defined, because the definition happens at run-time when control arrives
> to the point of class definition.
> Since early binding is quite complex, it is best to assume classes always
> are defined at run-time and define them before use.
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>
--
Best regards,
Jingcheng Zhang
Beijing, P.R.China