[PHP-DEV] Question about Classes

2002-10-30 Thread Juerg Zgraggen
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 "Return-Object";
   echo "";
   echo "Modul:" . $this->strModul . "";
   echo "Method:" . $this->strMethod . "";
   echo "Number:" . $this->nNumber . "";
   echo "Description:" . $this->strDescription .
"";
   echo "";
  }
  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";
  }
 }





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




[PHP-DEV] question about classes

2001-02-12 Thread David Guerizec

Hi,

I implemented my own classes in an extension, but when I instanciate 
them, they don't have any properties.

I called the macro INIT_OVERLOADED_CLASS_ENTRY (well, an equivalent that 
uses strlen() instead of sizeof()) cause I want to have write control 
over some properties:

   MGD_INIT_OVERLOADED_CLASS_ENTRY(
   (*midgard_class)->class_entry,
   (*midgard_class)->name,
   (*midgard_class)->methods,
   NULL,
   NULL,
   (*midgard_class)->set_property
   );

And (*midgard_class)->methods is a table that contains an alias of the 
same name as the class name (the constructor that creates all properties).
But this constructor never gets called.
I tried to implement the function call mechanism (replacing the first 
NULL above with (*midgard_class)->function_call) but then I have to 
strncmp() all the function names...

Is there a way to call the constructor automatically ?

-- 
Best Regards,
David Guerizec   Free Software Developer
Aurora R&D   [EMAIL PROTECTED]
Midgard core developer   http://www.midgard-project.org/


-- 
PHP Development Mailing List 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]