note 58943 rejected from language.oop5.basic by nlopess
| From: | nlopess@php.net | Date: | Mon, 21 Nov 2005 17:50:44 +0000 |
| Subject: | note 58943 rejected from language.oop5.basic by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-98895@lists.php.net to get a copy of this message | ||
Note Submitter: net_navard at yahoo dot com
----
Hello firends
When we discuss about OOP ,There is something that we name "encapsulation".
Please pay attention to this code:
<?php
$global_obj=null;
class my_class
{
var $value;
var $g;
function my_class()
{
global $global_obj;
$global_obj=&$this;
}
}
$a= new my_class();
$a->my_value=5;
$global_obj->my_value=10;
cho $a->my_value;
?>
As you see,
my_value is not member of my_class,But it can be used by $a
That is an instance of my_class,Why a variable that is not defined in class and is from out of class
can be accessible by in stance of that class?
Isn't it one of weak point of PHP's OOP?
With Regards
Amir Hossein Estakhrian