Afficher un message
Vieux 12/09/2007, 19h03   #1
PaowZ
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut accessing vars from within classes

Hello there!

I'd like to make some declared vars available to classes, such as:

<? //main environment
$myVar = new MyClass(); //the var I want to be available to OtherClass
....
....
class OtherClass{
private $otherVar = $myVar; //seems to not work
...
}
?>

...and I wish to initialize $otherVar 'as is', I mean, without having
to pass arg through __construct(). The way I tried above doesnt seem
to work, unlike it would be in a function..

any idea ??

thanks a lot

  Réponse avec citation
 
Page generated in 0,04355 seconds with 9 queries