"Andrea Faulds" wrote in message
news:3c77d1e5-acf1-442d-bc84-59e49efd6...@ajf.me...
On 19 Jan 2015, at 10:05, Tony Marston <tonymars...@hotmail.com> wrote:
"Marcio Almada" wrote in message
news:caoshv+uho3ovs-beqmdjomz4sdwoyjn7znmcqmt8byynugq...@mail.gmail.com...
Perhaps there should be a new rule which says that invoking a
constructor with anything other than "new" or "parent::__contruct()"
should be illegal, in which case this situation would generate an
error.
Now this would break a lot of code that $obj->__construct(); or
$this->__construct(); And I've seen a lot of it.
Surely, according to the principles of OO, a class constructor should
ONLY be called when the class is constructed/instantiated into an object
via the "new" verb? Google for "class constructor" and you will see all
those links which say the same thing.
Inheritance is also an OO principle, and typically a derived class’s
constructor will call the parent’s.
That is precisely why I said that "parent::__construct()" should still be
legal.
--
Andrea Faulds
http://ajf.me/
--
Tony Marston
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php