Class question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello ALL!
 I tried to make a class in another class something like:

<?php
class A{
  function a(){
    echo "Hello from class A a subclass of ".$this->parent->var1;
  }
}

class B{
  function b(){
    $this->var1="Class B";
    $this->var2=new A();
  }
}

$c=new b();
?>

In this script I use class A inside class B and I want to use
variable from B inside A.

I wanted: Hello from class A a subclass of Class B
But the result is: Hello from class A a subclass of

Is it possible something like: $this->parent->var1 or similar?
-- 
Best regards,
 Alex

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux