You are here: Re: [PHP] Re: php 5 interfaces « PHP « IT news, forums, messages
Re: [PHP] Re: php 5 interfaces

Posted by Sergio Gorelyshev on 01/20/05 18:41

On Thu, 20 Jan 2005 16:39:21 +0100
"M. Sokolewicz" <tularis@php.net> wrote:

> Sergio Gorelyshev wrote:
> > Hi all.
> >
> > Situation:
> >
> > interface MyInterface {
> > public static myMethod();
> > }
> >
> > class MyClass implements MyInterface {
> > public static myMethod() {}
> > }
> >
> > This sample will crash with message
> > Fatal error: Access type for interface method MyInterface::myMethod() must be omitted in somefile.php on line NN
> >
> > Why I'm not able to clarify call's type (static) for methods in interface? I'm predict closely that method myMethod() in all classes which implements MyInterface must be called statically. A little trick allowed to me to resolve this problem, but my question more ideological than practical.
> >
> > Thanks
> it's not the static part, it's the public part. You can't make
> non-public static methods. It's simply impossible by the definition of
> protected and private (both allow only the object itself to access it,
> or (in case of protected) a descendent).
>
> So, removing the public part should work out fine.
>
I'm confused. Construction like that:
<?php
interface MyInterface {
public static function myMethod();
}

class MyClass implements MyInterface {
public static function myMethod() {}
}

MyClass::myMethod();
?>
fork fine when i'm fetched it from my framework. But it's crashes inside framework with previous message.

> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


--
RE5PECT
Sergio Gorelyshev

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация