Ashley Sheridan wrote:
That would seem sensible to me though really. A constructor only bears
true for the base class, so any classes which inherit it must
incorporate all the constructor parts. A destructor doesn't know about
further classes which will need to inherit it, so it shouldn't be
inh
i test your codes again,it is work correctly!
But for backends compatibly with older php versions my codes is better
:),i'm sorry for my mistake at moment.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Stuart, u are right, the refcount in php 5 doesn't matter, where something
left behind in my memory from earlier days, However i do have the effect
that unsetting an object does NOT call __dectruct() ! but when the script
ends it is called. this can be easily tested by putting a echo in destruct.
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
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 sim
2009/8/24 Ralph Deffke :
> this is also not the full truth try this and it works
> what are the circumstances that is causing this problem then, yes I do have
> distributed references over my script and there are clearly references still
> set, however after running the snipped script I can not see
this is also not the full truth try this and it works
what are the circumstances that is causing this problem then, yes I do have
distributed references over my script and there are clearly references still
set, however after running the snipped script I can not see what I do
special in my script c
2009/8/24 Ralph Deffke
> typing error sorry
>
> forget my last post
>
> is there a was to destroy an object if there is hold a reference somewhere?
>
> "Stuart" wrote in message
> news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com...
> > 2009/8/24 kranthi :
> > > unset($obj) always
typing error sorry
forget my last post
is there a was to destroy an object if there is hold a reference somewhere?
"Stuart" wrote in message
news:a5f019de0908240606x5fdca70bkb31dd32b072e5...@mail.gmail.com...
> 2009/8/24 kranthi :
> > unset($obj) always calls the __destruct() function of the cl
On Mon, 2009-08-24 at 15:13 +0200, Ralph Deffke wrote:
> that is correct and that is the problem, and even that is not all !!!
>
> try this
>
>
> abstract class a {
> public function __construct(){
> echo "constructing";
> }
> public function __detruct(){
> echo "destructing..
that is correct and that is the problem, and even that is not all !!!
try this
";
}
public function __detruct(){
echo "destructing";
}
}
class b extends a{
}
$c = new b();
unset( $c );
?>
the constructor is inherited, the destructor not !!
PHP 5.2.9-1 and
PHP 5.3.0 behave the sam
kranthi wrote:
unset($obj) always calls the __destruct() function of the class.
Never calls the dtor. The dtor will be called only when the reference
count reaches 0.
class c { function __destruct() { echo 'dying !' ; } }
$v1 = new c ;
$v2 = $v1 ;
unset($v1) ; // don't call the dtor
unset
2009/8/24 kranthi :
> unset($obj) always calls the __destruct() function of the class.
>
> in your case clearly you are missing something else. Probably
> unset($anobject) is not being called at all ?
That's not entirely correct. PHP uses reference counting, so if
unsetting a variable did not caus
unset($obj) always calls the __destruct() function of the class.
in your case clearly you are missing something else. Probably
unset($anobject) is not being called at all ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
14 matches
Mail list logo