Re: Object STUFF

From: Date: Fri, 08 Dec 2000 00:13:02 +0000
Subject: Re: Object STUFF
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-29250@lists.php.net to get a copy of this message
> The problem we're running into is duplicating the ASP "Set" command. > The asp developers have explained it thusly: > "Set is used to set one object as the value of a property of > another object" Near as I could ever figure, SET was needed only if the assignment involved a non-scalar value, and you didn't want it turned into a scaler. EG: <% foo = db.query("select * from whatever") set bar = db.query("select * from whatever") %> Here, bar would be a valid record set, but foo would only have the first record or something weird like that. I never really understood how that correlated to the docs for SET, which said something entirely weird. At any rate, I'm not convinced that the ASP developer's definition is all that accurate. > So, the code that immediately sprang to mind was this: > > $firstObj = new COM("windozecrap.dll"); > $anotherObj = new COM("morecrap.dll"); > > $firstObj->Prop = $anotherObj; > > Apparently this does not work. Does not work in what sense? > We've tried another method which > involves using =& but that doesn't seem to work either. Oooh. The & will make a reference (kinda like an alias) for the object... I'm really not sure what, if any, correspondence there is between COM objects and references and non-references... And I for sure don't know squat about the COM object model and how references are handled. Wild Guesses: Is there any chance of making anotherObj first, and then passing it in to the constructor of firstObj?... $anotherObj = new COM("morecrap.dll"); $firstObj = new COM("windozecrap.dll", $anotherObj); Or perhaps giving firstObj a function that takes $anotherObj as an arg rather than setting the property directly?

« previous php.general (#29250) next »