On Fri, 29 Aug 2003 15:19:23 +0200, you wrote:

>On page "A" of my homepage I create an object "1" which itself creates an
>object "2".
>Now how can I access the properties of object "2" from "A" ?

Two approaches. C contains an instance of A or E extends A.

<?
        class A
        {
                function B ($s = "None")
                {
                        echo ("<p>input : $s</p>");
                }
        }
        
        class C
        {
                var $instance_of_A;
                function C ()
                {
                        $this->instance_of_A = new A();
                }
                function D ()
                {
                        $this->instance_of_A->B("Hello World");
                }
        }

        class E extends A
        {
                function F ()
                {
                        $this->B ("Hello World");
                }
        }
        
        $x = new C();
        $x->D();

        $x = new E();
        $x->F();
?>

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

Reply via email to