1. Can i initialize an object of another class in a class eg

Code:
class db {
public function connect() {  ------ }
........... }

class user {

public $name;

$obj=new db();

}
and then use the above like
Code:
$user = new user();
$user->obj->connect();

2. If i have two classes A and B how can i call functions of class A withing class B?