Re: unset( $anobject) does not invoce __destruct()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I dont agree, and as u see in my snipped code it works fine.

in an abstract class u can define an implementation to define some basic
things a overwriting function in an extending class has to take care of as
well.

this includes specialy magic functions.

thats what they are made for. may be you talk about interfaces ?

"hack988 hack988" <hack988@xxxxxxxxxxxxx> wrote in message
news:4d03254c0908241122r5b6d1c3csc06ec475a0797218@xxxxxxxxxxxxxxxxx
> see http://cn.php.net/manual/en/language.oop5.abstract.php
> PHP 5 introduces abstract classes and methods. It is not allowed to
> create an instance of a class that has been defined as abstract. Any
> class that contains at least one abstract method must also be
> abstract. Methods defined as abstract simply declare the method's
> signature they cannot define the implementation.
>
> You make misconception understand for abstract class,:(, correct code is:
> abstract class a {
>    abstract public function __construct(){
>
>   }
>   abstract public function __destruct(){
>
>   }
>  }
>
>  class b extends a{
>    public function __construct(){
>     echo "constructing....<br>";
>   }
>   public function __destruct(){
>     echo "destructing....<br>";
>   }
>  }
>
>  $c = new b();
> unset($c);
>
> if you want to make it work correctly that you want,plase change code to
follow
> class c {
>    public function __construct(){
>     echo "constructing....<br/>";
>   }
>   public function __destruct(){
>     echo "destructing....<br/>";
>   }
> }
>
>  class d extends c{
>
>  }
>   $e = new d();
>   unset($e);



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux