Re: Re: Why isn't base class constructors or destructors required to be called? (was: Re: [PHP-DEV] Return type hints)

From: Date: Fri, 15 Sep 2006 09:16:41 +0000
Subject: Re: Re: Why isn't base class constructors or destructors required to be called? (was: Re: [PHP-DEV] Return type hints)
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.internals 
Request: Send a blank email to internals+get-25719@lists.php.net to get a copy of this message
>From: "Marian Kostadinov" <manchokapitancho@gmail.com> >Well, PHP is a loosely typed language. You have much more freedom when you >write a code. Constructors are not an exception. It is very convinient that >you may not call the parent constructor and many people do it, believe me! Why would you not call the base class constructor/destructor? Could you give an example? Regards, Terje 2006/9/15, Terje Slettebø <tslettebo@broadpark.no>: > > >From: "Marcus Boerger" <helly@php.net> > > > PHP is not C++ and speaking of constructors and destrcutors PHP goes > morethe > > Delphi way. > > I'd also like to know _why_ constructors/destructors are less fit for PHP, > than these other languages? How can you be sure that objects of a class > are > properly initialised, and that they clean up after themselves? (Yes, I > know > the runtime cleans up after them, at script termination, if want to be > sloppy, but that still doesn't cover the constructor case)

« previous php.internals (#25719) next »