You are here: Re: Php 5 : polymorphic class « PHP Programming Language « IT news, forums, messages
Re: Php 5 : polymorphic class

Posted by Jerry Stuckle on 11/01/47 11:29

Tony Marston wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> news:SbudndpdiOjQJNfeRVn-iA@comcast.com...
>
>>Baptiste Pillot wrote:
>>
>>>Hello,
>>>
>>>
>>>With php4 I did the following in class initialisation :
>>>
>>>class base_class {
>>>
>>>function modify_polymorphic($otherclass){
>>> $this=new $otherclass();
>>>}
>>>
>>>function other_function(){
>>> echo "Base method";
>>>}
>>>
>>>}
>>>
>>>class herited_class extends base_class {
>>>
>>>function other_function(){
>>> echo "Herited method";
>>>}
>>>
>>>}
>>>
>>>$base=new base_class();
>>>$base->modify_polymorphic("herited_class");
>>>$base->other_function();
>>>
>>>This will echo "Herited method" in PHP 4.
>>>But in PHP 5 it does not wand to work at all.
>>>PHP interpreter says :
>>>
>>>Fatal error: Cannot re-assign $this in scriptname.php on line 10
>>
>>That is correct. It's never been valid to reassign $this. But previous
>>versions of PHP let it by.
>
>
> You sample code also shows that you do not understand what "polymorphism"
> actually means.
>

Noe my code...


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

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

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