I've just started to learn OOP PHP and i'm trying create class that will do connection to my data base.

The code:

```
  class DB_CONNECT
    {
    private $host ;
    private $dbName ;
    private $userName ;
    private $password;
    private $db;

    public function __construct($host,$dbName,$userName,$password){

        $this->host = $host;
        $this->dbName = $dbName;
        $this->userName = $userName;
        $this->password = $password;

        try {

             $this->db = new PDO('mysql:host='.$this->host.';dbname='.$this->dbName.';charset=utf8',$this->userName,$this->password);
             $this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
             return $this->db;
        } catch (Exception $e) {

            ECHO $e->getMessage();
        }

    }   

}

 $db = new DB_CONNECT("localhost", "oopcms","viktor","viktor");

 function select($db){

    $query = $db->prepare("SELECT * FROM `test`");
    $query->execute();
    $row = $query->fetchAll(PDO::FETCH_ASSOC);
    return $row;
 }

 $x = select($db);
 var_dump($x);

```

But I am getting this error:

```
 Fatal error: Call to undefined method DB_CONNECT::prepare();

```

What I understand is that the PDO object couldn't be created. Can you give some guidance please?