When i implemented an interface in a class and executed the code, it appeared the following error:
Fatal error: Interface 'IConn' not found in C:\xampp\htdocs\aulaPHP\SoNet\php_oo\OO_advanced\code_03_class_conn\Conn.php on line 3
The problem in this is that all the files are correctly placed, together, but the Interface cannot be found at the "Conn" file. Here's the code:
<?php
class Conn implements IConn
{
private $dsn;
private $user;
private $pass;
public function __construct($dsn, $user, $pass)
{
$this->dsn = $dsn;
$this->user = $user;
$this->pass = $pass;
}
public function connect()
{
return new \PDO($this->dsn,$this->user,$this->pass);
}
}
?>