1

so i have a class here that have a function who requires another class to create an object. I use namespace in both files, my question is can i get rid of this line here: include("class.php"); and instantiate class using namespace?

here is the file from where i call the other class:

namespace namespaceName;

class classLoader{
     public function __construct() {
        //not used
     }

     public function executeFunctionOutsideTheNamespace() {
        include("class.php");
         new classExtended("badass");
    }
}

and the class by itself:

namespace namespaceName;

class classExtended extends classBase
{    
    public function __construct($action) {
        echo $action;
    }
}

I ask again, using Namespace there is no possibility to get rid of include() or require(), require_once() functions? to call directly new classExtended("badass"); ?

Robert-Dan
  • 337
  • 2
  • 4
  • 13

0 Answers0