Re: [PHP-GENERAL] Can I use Functional Pointer? / Javascript bracelet conflict ?

[email protected] (Jan Dvorak)
Newsgroups php.general
Organization MathAn Praha, Ltd.
Message-ID <[email protected]>
Lin Zhemin wrote:
> 
> Den dobry, Jan. :-)

Dobry den :-)

(I'm sorry I don't know the greeting in your language.)

> However, there's another confusion. I know that PHP won't
> initialise a derived object, but I'm worried that I'm not sure
> if it's a waste of resource that I initialise the derived object
> each time a deriving object needs to use some of the statistic
> functions of the derived object. Like in line 9:
> 
>  1  class A {
>  2    function A() { echo "A::constructor<br>"; }
>  3    function funca() { echo "A::funca<br>"; }
>  4  }
>  5
>  6  class B extends A {
>  7    function B() { echo "B::constructor<br>"; }
>  8    function funca() { echo "B::funca<br>"; }
>  9    function functry() { $fp = new A; $fp->funca(); $this->funca(); }
> 10  }
> 11
> 12  $a = new B;
> 13  $a->functry();
> 
> Is there a better solution? Thanks a lot!

Yes.  See the user comments at http://www.php.net/manual/oop.php .

Jan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.