Hello,

i have a question:

How to access class members?

I have the following class definition:

class Mitarbeiter{

           public $name = 'meier';
           public $alter = '50';
           public $gehalt = '2000';
           public $abteilung = 'programmierung';

           function printMember(){
              echo 'Name: ' . $this->public;
              echo 'Alter: ' . $this->public;
              echo 'Gehalt: ' . $this->public;
              echo 'Abteilung: ' . $this->public;
           }
      }

Now i want to access the public member with:

$m = new Mitarbeiter();
$m->printMember();

When calling method printMember() i get an error "cannot access empty
class member".

I dont see why the class members are empty?

Regards
Alexander

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

Reply via email to