Jump to content

Class problem


bolven2000

Recommended Posts

class Z {

  function foo() {

      // do somethig

  }

}

 

 

class X {

  $x

 

  function __contruct() {

        $this->x = new z();

  }

 

  function var() {

      $this->x->foo(); // Fatal error: Using $this when not in object contex

  }

}

 

// Class declaration here

class Y {

    function __contruct() {

        $z = new z();         

        $x = new x();

    }

}

 

Link to comment
https://forums.phpfreaks.com/topic/209318-class-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.