Re: [PHP] Class Con- and Destructor Inheritance

2004-08-23 Thread Daniel Schierbeck
Curt Zirzow wrote:
* Thus wrote Justin Patrin:
On Sun, 22 Aug 2004 13:04:11 +0200, Daniel Schierbeck [EMAIL PROTECTED] wrote:
...
   Note:  Parent constructors are not called implicitly. In order
   to run a parent constructor, a call to parent::__construct() is
   required.
Is this an error in the manual or in PHP itself? Should I report it
somewhere?
No, this is not a bug. This means that if you define a new constructor
/ destructor, the parent class's won't be called unless you put it in
the new ones.

Although not a bug, it is a little misleading, i've corrected it to
explain when the constructor isn't called.
Curt
Thanks, all i needed to know :)
The manual's a bit confusing on that part...
Cheers,
Daniel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Class Con- and Destructor Inheritance

2004-08-22 Thread Daniel Schierbeck
Hello there. I was experimenting a bit with the constructors and 
destructors, and found that this code:

?php
class First
{
public function __construct ()
{
echo Hello, World!\n;
}

public function __destruct ()
{
echo Goodbye, World!\n;
}
}
class Second extends First
{
}
$second = new Second;
?
Outputs
Hello, World!
Goodbye, World!
, yet the PHP manual 
(http://www.php.net/manual/en/language.oop5.decon.php) says:

Note:  Parent constructors are not called implicitly. In order  
to run a parent constructor, a call to parent::__construct() is
required.
Is this an error in the manual or in PHP itself? Should I report it 
somewhere?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Class Con- and Destructor Inheritance

2004-08-22 Thread Justin Patrin
On Sun, 22 Aug 2004 13:04:11 +0200, Daniel Schierbeck [EMAIL PROTECTED] wrote:
 Hello there. I was experimenting a bit with the constructors and
 destructors, and found that this code:
 
 ?php
 
 class First
 {
 public function __construct ()
 {
 echo Hello, World!\n;
 }
 
 public function __destruct ()
 {
 echo Goodbye, World!\n;
 }
 }
 
 class Second extends First
 {
 
 }
 
 $second = new Second;
 
 ?
 
 Outputs
 
 Hello, World!
 Goodbye, World!
 
 , yet the PHP manual
 (http://www.php.net/manual/en/language.oop5.decon.php) says:
 
 Note:  Parent constructors are not called implicitly. In order
 to run a parent constructor, a call to parent::__construct() is
 required.
 
 Is this an error in the manual or in PHP itself? Should I report it
 somewhere?
 

No, this is not a bug. This means that if you define a new constructor
/ destructor, the parent class's won't be called unless you put it in
the new ones.

-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Class Con- and Destructor Inheritance

2004-08-22 Thread Curt Zirzow
* Thus wrote Justin Patrin:
 On Sun, 22 Aug 2004 13:04:11 +0200, Daniel Schierbeck [EMAIL PROTECTED] wrote:
  
  ...
  
  Note:  Parent constructors are not called implicitly. In order
  to run a parent constructor, a call to parent::__construct() is
  required.
  
  Is this an error in the manual or in PHP itself? Should I report it
  somewhere?
  
 
 No, this is not a bug. This means that if you define a new constructor
 / destructor, the parent class's won't be called unless you put it in
 the new ones.

Although not a bug, it is a little misleading, i've corrected it to
explain when the constructor isn't called.


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