Re: Beginner Tutorials for using CLASSES in PHP4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/10/07, Robert Cummings <robert@xxxxxxxxxxxxx> wrote:
>
> On Wed, 2007-10-10 at 22:15 -0400, Nathan Nobbe wrote:
> > well i have to say i dont really see the difference between an
> > implicit and explicit interface.
> >
> > the example you gave looks like it works just like the example i gave.
> >
> > in your example the check for the function is performed at runtime.
> > in the example i gave the check for the interface is performed at
> > runtime.
>
> Interfaces are checked at parse time. I'm very sure you need to include
> the interface description before you can implement it. That makes it
> explicit. My example doesn't need any interface description, the
> interface of "wiggle()" is implicit.
>
> > the only difference is that in mine php does the check and in yours
> > method_exists()
> > does the check.
>
> I only put that there for fun. I could have skipped the check entirely.
> Then it would be expected that the wiggle() method existed. If the
> method doesn't exist then at run time the script will stop-- fortunately
> with a fatal error :)


i suppose the same could be done with the interface construct as well;
simply remove the type hinting with the name of the interface and the
call becomes implicit.

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux