<?php
/*
 * Kompendium der Web-Programmierung
 * Webapplikationen mit PHP
 * 
 * Objektorientierung in PHP
 * Klasse Buch (Klasse mit Attributen, Konstruktor, Methode)
 */
 
class Buch {

	// Attribute (gekapselt)
	protected $titel,$nname,$vname,$verlag,$buch,$jahr;
	
    // Syntax PHP4:
	//function Buch($titel,$nname,$vname,$verlag="Springer",$jahr=2007) {
    
	// Konstruktor
	function __construct($titel,$nname,$vname,$verlag="Springer",$jahr=2007) {
		$this->titel  = $titel;
		$this->nname  = $nname;
		$this->vname  = $vname;
		$this->verlag = $verlag;
		$this->jahr   = $jahr;
	}   // Konstruktor
	
	// Methode
	public function __toString() {
		$buch = $this->vname." ".$this->nname.": ".$this->titel.
		        " (".$this->verlag.", ".$this->jahr.")";
		return $buch;
	}  // __toString
	
}  // class

?>