Reply to references

Your name:

Reply:


Posted by amygdala on 04/12/07 21:10

I'm trying to figure out the correct use of references.

Lets say I have a class Validator and a class User. And I want to let a User
instance be an referenced object in Validator. Where would the best place be
to put the & sign, and why? (See the /* */ comments inside code)

class Validator
{
public function __construct( /* here? */ $caller )
{
$this->class =/* here? */ $caller;
}
}

class User
{
$private validator = NULL;
public function __construct()
{
$this->validator = new Validator( /* or here? */ $this );
}
}

Also, what would happen if were to put & signs in multiple places sprecified
in this particular example? Would it be redundant?

Thank you for any insight.

[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

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