但是,用ie来检查的话,就出问题啊
不相信,把代码下走,来test一下

解决方案 »

  1.   

    <?php
        class Person
        {
            var $m_strItemName;
            
            function Person( $strItemName = "nothing" )
            {
                $this ->m_strItemName;
            }        function GetPlayInfo()
            {
                return $this ->m_strItemName;
            }
        }    class Allen extends Person
        {
            function Tom( $strItemName )
            {
                parent::Person( $strItemName );
            }        function GetPlayInfo()
            {
                echo "Allen now playing ".parent::GetPlayInfo();
            }
        }    class Steven extends Person
        {
            function Tom( $strItemName )
            {
                parent::Person( $strItemName );
            }        function GetPlayInfo()
            {
                echo "Steven now playing ".parent::GetPlayInfo();
            }
        }    class Men extends Person
        {
            var $m_arrPerson = array();        function Men()
            {
                parent::Person();
            }        function Add( &$aPerson )
            {
                array_push( $this->m_arrPerson, $aPerson );
            }        function GetPlayInfo()
            {
                $nCnt = count( $this ->m_arrPerson );            echo "<br/>","Member of club is ", $nCnt;
                for( $i = 0; $i < nCnt; $i++ )
                {
                    $this ->m_arrPerson[ $i ] ->GetPlayInfo();
                }
            }
        }
    ?>
    <html>
        <title>Person Play</title>
        <body>
            <?php
                $allen = new Allen ( "basketball" );
                $steven = new Steven( "football" );            $men = new Men();
                $men ->Add( $allen );
                $men ->Add( $steven );
                $men ->GetPlayInfo();
            ?>
        </body>
    </html>少了个$this而已,呵呵,多不小心
      

  2.   

    function Add( &$aPerson )
    {
    array_push( $this->m_arrPerson, $aPerson );
    }