简体   繁体   中英

class another class method in another class in php

I created a class named function and calling function method in another class named test. But it shows me an error -

PHP Fatal error: Call to a member function

my function class's object name is $obj = new functions();

when i call user method which is written in function class from test class I am getting an error.

 class className {
        function users(){
         $users = "Demo User"; return $user;
         }
  } 
 $obj = new functions(); 

you mean this:

you can extends

class className extends test{
   function __construct(){

here you add

}

    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM