Reply to Re: Referencing objects?

Your name:

Reply:


Posted by Colin McKinnon on 01/13/07 00:36

Schmidty wrote:

> Fairly new to OOP and PHP5.
<snip>
>
> Example ==========================================================
>
> class NAME {
> public $name;
> public $unknown;
> public $value;
>
>
> function __construct($value) {
> $this->setName($this->value);

no - I guess you want to assign the value in the parameter using the setName
method...
$this->setName($value);
> }
>
> function setName($value) {
> $this->name = $value;

Yup - just like that

> }
>
> function getName() {
> return $this->name;
> }
>
> function nameKid($unknown) {
> $this->setName($unkown);
erm, not sure what this is trying to (even without the typo).

Looks like your nearly there.

HTH

C.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация