Re: Object STUFF
| From: | szii@sziisoft.com | Date: | Thu, 07 Dec 2000 13:00:33 +0000 |
| Subject: | Re: Object STUFF | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-29258@lists.php.net to get a copy of this message | ||
PHP's objects are loosely C++ based. The properties/data members are not
hidden, so therefore can be accessed directly. Usually you'll write a
couple of
methods to manipulate the data members as a point of good practice and
style.
class foo
{
var $m_member;
function foo()
{
// do nothing
}
// Note that this sets $m_member to value by reference and
// not by value.
function SetMyMember(&$value)
{
$this->m_member = $value;
}
}
<?php
$something = 42;
$obj = new foo();
$obj->SetMyMember($something);
// OR
$obj->m_member = $something;
?>
'Luck!
-Szii
----- Original Message -----
From: <mccrorey@optushome.com.au>
To: <php-general@lists.php.net>
Sent: Thursday, December 07, 2000 3:24 PM
Subject: [PHP] Object STUFF
>
> Hi guys,
>
> The current project we're working on here involves converting
> our entire site from IIS/ASP to Apache/PHP. But, we're doing
> it slowly. First we're going to go to IIS/ASP/PHP and then migrate
> things a bit at a time. Seemed like a good idea at the time.
> =)
>
> 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"
>
> 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. We've tried another method which
> involves using =& but that doesn't seem to work either.
>
> Any of you php-gurus out there have a clue? I would be, as always,
> pathetically grateful for any tips.
>
> TIA
> Cheers,
>
> Brad McCrorey
>
>
> -----
> Sent using MailStart.com ( http://MailStart.Com/welcome.html )
> The FREE way to access your mailbox via any web browser, anywhere!
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net