You are here: Re: beginner oop: class not alway working « All PHP « IT news, forums, messages
Re: beginner oop: class not alway working

Posted by Steve on 03/29/07 13:37

"Osewoudt" <oswwoudt@ufo.org> wrote in message
news:460b96a1$0$9277$ba620dc5@text.nova.planet.nl...
|
| > It appears that the class would only ever be a single instance.
| > If so you should be setting the values within the constructor.
| > ie;
| > $test = new WachtwoordGenerator(8, 3, 2, 4);
|
|
| that is the way i did it in an earlier version, but then i read about
__set
| and __get so i wanted to use that.

of course you do realize that __get and __set only work on interfaces that
DON'T exist on your object, right?

ex.:

class foo
{
public $bar = 'hello world';
public function __set($name, $value)
{
trigger_error('<pre>' . $name . ' is not a valid interface.</pre>',
E_USER_WARNING);
}
}

echo foo::$bar; // no error
echo foo::$Bar; // error here

| > Although this appears to be a test and learning project it's a good time
| > to
| > create some good habits.
| > The class should encapsulate more functionality than this one does.
| > The numbers "8, 3, 2, 4" have to come from somewhere. Why not generate
| > them
| > within the class itself with rand numbers.
| > Then you could do the following;
| > $test= new WachtwoordGenerator();
| > $password = $test->pword();
|
| now you can control yourself how many elements there are in the password
and
| from which set of caracters they come.

that's the idea.

| No, I'm not calling you a "dipstick" :)
|
| then you are the first who doesn't

ah, a pessimist.

 

Navigation:

[Reply to this 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

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