Justtechjobs.com Find a programming school near you






Online Campus Both


php3-list | 2000051

[PHP3] encapsulation in php... From: Rajani Iyer (rajani_21 <email protected>)
Date: 05/08/00

hi Michael,

I'll look into the perl book recommended by you. In
fact what you've written is exactly what i'm looking
for in php. To be more specific let's take an example:
<?
class Cart
{
 private :
     var $owner;
     function set_owner(name){
         $this->owner = name;
    }

}

My_cart = new Cart
Mycart->set_owner("Rajani");

/* A statement like this should report an error */
Mycart->owner = "Rajani"

?>

Only the class functions should be allowed to
manipulate the values of the variables.

But i tried declaring the scope of the variable as
private in php as above. But gives me error.

I want a soln for this badly. pl help...

--Rajani

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/

-- 
PHP 3 Mailing List <http://www.php.net/>
To unsubscribe, send an empty message to php3-unsubscribe <email protected>
To subscribe to the digest, e-mail: php3-digest-subscribe <email protected>
To search the mailing list archive, go to: http://www.php.net/mailsearch.php3
To contact the list administrators, e-mail: php-list-admin <email protected>