Re: php5 and object
| From: | Krzysztof Gorzelak | Date: | Wed, 28 Jul 2004 19:42:50 +0000 |
| Subject: | Re: php5 and object | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192124@lists.php.net to get a copy of this message | ||
A change to interface gives me such error :
Interface function Strona::foo() cannot contain body
Krzysztof Gorzelak
krzysztof@uno.pl
Uzytkownik "Stephen Sadowski" <stephen.sadowski@gmail.com> napisal w
wiadomosci news:cde4320d040728122949321324@mail.gmail.com...
> http://us4.php.net/manual/en/language.oop5.abstract.php
>
> The short is that you can't do anything more than define a function in
> an abstract class.
>
> IIRC, change abstract to interface, and you'll probably be okay.
>
> On Wed, 28 Jul 2004 21:18:26 +0200, Krzysztof Gorzelak <krzysztof@uno.pl>
wrote:
> > Hello,
> >
> > I'm trying to make this code to work:
> >
> > // start of code
> > abstract class Strona {
> >
> > abstract public function generuj_strone();
> >
> > function foo() {
> > generuj_strone();
> > }
> > }
> >
> > class Katalog extends Strona {
> > public function generuj_strone() {
> > echo "OK";
> > }
> >
> > }
> >
> > $bar = new Katalog();
> > $bar->foo();
> > // end of code
> > And I get such error :
> > Fatal error: Cannot call abstract method Strona::generuj_strone() in
....
> >
> > And I expect word: OK
> > Is it a bug or a normal behaviour ?
> >
> > Thanks for help!
> >
> > Krzysztof Gorzelak
> > krzysztof@uno.pl
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >