Perhaps it is a very simple issue, but I'm missing something in OOP fundamentals. Suppose I have to php file, say file1 and file2. file1 implements a class from the class Class, and in some of the method of the latter, say MethodA. In MethodA, I instantiate a class say $object from the class Object (which comes from another file3), and I call a method, say MethodB that takes as an argument the instantiation $object, and processes to set the value of one attribute of the instantiation $object. So, the scheme is the following :
class Class{
public function MethodB($object){
$param
...
$object->setValue($param);
...
}
public function MethodA(){
$object = new Object;
...
$this->MethodB($object);
...
$object->getValue();
}
}
Now the problem is that I am not able to get back the value of $object->getValue($param)
, and the question is why?