File 1 - /Users/jitendraojha/www/DesignPatternsWithPhpLanguage/FactoryPattern/FactoryClassPattern/UserInterface.php
<?php
namespace DesignPatternsWithPhpLanguage\FactoryPattern\FactoryClassPattern;
interface UserInterface
{
function setFirstName($firstName);
function getFirstName();
}
?>
File 2 - /Users/jitendraojha/www/DesignPatternsWithPhpLanguage/FactoryPattern/FactoryClassPattern/User.php
<?php
namespace DesignPatternsWithPhpLanguage\FactoryPattern\FactoryClassPattern;
class User implements UserInterface
{
private $firstName = null;
public function __construct($params) { }
public function setFirstName($firstName)
{
$this->firstName = $firstName;
}
public function getFirstName()
{
return $this->firstName;
}
}
?>
Problem
php FactoryPattern/FactoryClassPattern/UserInterface.php
- Runs fine.
php FactoryPattern/FactoryClassPattern/User.php
- gives following errors: PHP Fatal error: Interface 'DesignPatternsWithPhpLanguage\FactoryPattern\FactoryClassPattern\UserInterface' not found in /Users/jitendraojha/www/DesignPatternsWithPhpLanguage/FactoryPattern/FactoryClassPattern/User.php on line 7
I had use UserInterface;
added in File 2 with no solution.
Aucun commentaire:
Enregistrer un commentaire