class and inheritance

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

 



Hi,

I'm trying to create a class that has as public members some other class
object.
for that i use almost the same syntax as under C# or C++.

header class:

> <?php
> class CARMainHeader
> {
>     // title of the main table header
>     private $mTitle = null;
>
>     // holds the height of the table header
>     private $mHeight = null;
>
>     // constructor
>     public function __construct()
>     {
>         $this->mHeight = 15;
>         $this->mTitle = "Title";
>     }
>
>     // set the title of the main table
>     public function SetTitle($name)
>     {
>         $this->mTitle = $name;
>     }
>
>     // return the title of the main table
>     public function GetTitle()
>     {
>         return $this->mTitle;
>     }
>
>     // set the height of the header
>     public function SetHeight($height)
>     {
>         $this->mHeight = $height;
>     }
>
>     // return the height of the header
>     public function GetHeight()
>     {
>         return $this->mHeight;
>     }
> }
> ?>
>

main class code :

> <?php
> include_once 'CARMainHeader.php';
>
> class CARTable
> {
>     // holds the main table header object
>     public $mTableHeader = null;
>
>     // store the amount of columns in table
>     private $mColumnsCount = null;
>
>     // constructor
>     public function __construct()
>     {
>         $this->mTableHeader = new CARMainHeader();
>     }
>
>     // rendering of table
>     public function Render()
>     {
>         echo "<table>";
>         echo "<tr />";
>         echo "<td class=''>".$this->mTableHeader->;
>         echo "</td>";
>         echo "<td class=''>";
>         echo "</td>";
>         echo "</table>";
>     }
> }
> ?>
>

in the CARTable, i'm not able in the Render function to write
$this->mTableHeader->GetTitle();
why ?

-- 
Alain
------------------------------------
Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

[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