Heim > Fragen und Antworten > Hauptteil
<?phpclass Staff{ private $name; privates $Alter; privates $-Gehalt; öffentliche Funktion _construct($name,$age,$salary) { $this->name=$name; $this->age=$age; $this->salary=$salary; } public function _get($name) { return $this->$name; }}$obj=new Staff('peter',18,4000);echo $obj->name;echo $obj->age;?>