Path: csiph.com!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: de.comp.lang.php Subject: Re: private property Date: Thu, 10 Dec 2015 14:09:33 +0100 Organization: PointedEars Software (PES) Lines: 29 Message-ID: <1475223.GxYsoRzVMF@PointedEars.de> References: Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1449752973 23373 eJwFwQkBwCAMBEFLQG4DyGnz+JfADObTY8tx0fSfKm7QxhlsjaOyVq9L18bMFZbFdxJmrQcUbRC4 (10 Dec 2015 13:09:33 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Thu, 10 Dec 2015 13:09:33 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwNwgERwDAIA0BLDZBA5ayw+pew3T9dUGeICt7fWgNtO32CxXgxHph54HvQHLGC1l35ni7HMkvZTVje3vUBONEUoQ== Cancel-Lock: sha1:6GtITxft0qGgqpzj2vXJOhARfck= X-NNTP-Posting-Host: eJwVyNEVwEAEBMCWTthFOcjpv4S8zOdAKRw3gobF5tBfyd6poGip3OcEr0uhw/4DTsPG13zzAxRUEIA= Xref: csiph.com de.comp.lang.php:3588 Jan Novak wrote: > $archives = [ ... hole die daten aus der db ...] > $a = new ArchivListUi(); > $a->setArchives($archives); > $a->show('/template/archiv_list_ui.html'); > > ... > > class ArchivListUi extends generalClassFunctions{ > private $archives; > public function setArchives($archives){ > $this->archives = $archives; > } > } > > […] > Wenn in der Klasse "ArchivListUi" die Eigenschaft $archives als public > deklariert wird, funktiert es erwartungsgemäß. > Ist das die richtige Vorgehensweise, die Eigenschaft als public zu > deklarieren? Nein; Stichwort: „Datenkapselung“ (“information hiding”). -- PointedEars Zend Certified PHP Engineer Twitter: @PointedEars2 Please do not cc me. / Bitte keine Kopien per E-Mail.