Re: [PHP] php5 and object
Curt Zirzow wrote: * Thus wrote Stephen Sadowski: 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. Negative. It is perfectly fine to have code within an abstract class. The documentation needs to get expanded a little bit to define exactly how an for what use an abstract class can be used. indeed. Abstract classes can contain code - but abstract methods cannot. -- Raditha Dissanayake. http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader Graphical User Inteface. Just 128 KB | with progress bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP] php5 and object
> From: Stephen Sadowski <[EMAIL PROTECTED]> > Subject: Re: [PHP] php5 and object > > 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. Switch that around. Interfaces cannot contain anything but function definitions. Abstract classes can contain functions that'll be inherited. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5 and object
* Thus wrote Stephen Sadowski: > 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. Negative. It is perfectly fine to have code within an abstract class. The documentation needs to get expanded a little bit to define exactly how an for what use an abstract class can be used. Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5 and object
A change to interface gives me such error : Interface function Strona::foo() cannot contain body Krzysztof Gorzelak [EMAIL PROTECTED] Uzytkownik "Stephen Sadowski" <[EMAIL PROTECTED]> napisal w wiadomosci news:[EMAIL PROTECTED] > 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 <[EMAIL PROTECTED]> 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 > > [EMAIL PROTECTED] > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php5 and object
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 <[EMAIL PROTECTED]> 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 > [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php5 and object
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 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php