Re: how to access class members

Ferenc Kovacs <[email protected]>
Newsgroups gmane.comp.php.windows
Message-ID <[email protected]>
On Tue, May 4, 2010 at 3:02 PM, Alexander Schunk <[email protected]> wrote:

> 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;
>           }
>

this should be:
          function printMember(){
             echo 'Name: ' . $this->name;
             echo 'Alter: ' . $this->alter;
             echo 'Gehalt: ' . $this->gehalt;
             echo 'Abteilung: ' . $this->abteilung;
          }

Tyrael
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.