|
Posted by gosha bine on 07/19/07 10:53
On 19.07.2007 12:26 Mortimer wrote:
>> I've noticed in your first example you didn't assign anything to
>> MySecondClass->$obj, perhaps that is the problem ;)
>
> Sorry, i didn't write it, but i assign the object in the constructor,
> like this:
>
> class Session {
> private $db;
> function __construct($db) {
> $this->db = $db;
> }
> function __destruct() {
> echo "Destroyed Session\n";
> }}
>
> Uhm.. thank you
>
>
I'm lost now. :-o
What does this print for you?
class Database {
function __destruct() {
echo "Destroyed Database\n";
}}
class Session {
private $db;
function __construct($db) {
$this->db = $db;
}
function __destruct() {
echo "Destroyed Session\n";
}}
$db = new Database;
$sess = new Session($db);
die();
--
gosha bine
extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok
Navigation:
[Reply to this message]
|