Reply to Referencing objects?

Your name:

Reply:


Posted by Schmidty on 01/13/07 00:20

Fairly new to OOP and PHP5.
My question;

Maybe I am not thinking about this the right way? How do I reference a
variable or object(?) from one function to another in a class? Or how
do I pass the variable from one function or method to another? Am I
doing this right in the example below? How would I pass a variable from
one function to another?

Example ==========================================================

class NAME {
public $name;
public $unknown;
public $value;


function __construct($value) {
$this->setName($this->value);
}

function setName($value) {
$this->name = $value;
}

function getName() {
return $this->name;
}

function nameKid($unknown) {
$this->setName($unkown);
}
} // end class


$boy = new NAME("Joe");
$boy->getName();

Joe

END EXAMPLE ======================================================
Thanks,
Schmidty

[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

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