Question about Classes
| From: | Juerg Zgraggen | Date: | Wed, 30 Oct 2002 21:48:55 +0000 |
| Subject: | Question about Classes | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-90343@lists.php.net to get a copy of this message | ||
hi
i made a class in PHP. id like to define public and private function for
that class like in C++. is this possible? the public and private inside the
class does not work... why?
thanx, jürg zgraggen
/* My Class*/
class bz_ClassX
{
var $nNumber;
var $strDescription;
var $strModul;
// public: ??? does not work
function bz_ClassX()
{
$this->bz_reset();
}
function bz_print()
{
echo "<b>Return-Object</b><br>";
echo "<table>";
echo "<tr><td>Modul:</td><td>" . $this->strModul .
"</td></tr>";
echo "<tr><td>Method:</td><td>" . $this->strMethod .
"</td></tr>";
echo "<tr><td>Number:</td><td>" . $this->nNumber .
"</td></tr>";
echo "<tr><td>Description:</td><td>" . $this->strDescription
.
"</td></tr>";
echo "</table>";
}
function bz_clear()
{
$this->bz_reset();
}
// private: ??? does not work
function bz_reset()
{
$this->strModul = "Unknown";
$this->strMethod = "Unknown";
$this->nNumber = 0;
$this->strDescription = "Unknown";
}
}