View Single Post
Old 04-18-2009, 04:52 PM  
KRosh
So Fucking Outlawed
 
KRosh's Avatar
 
Industry Role:
Join Date: Nov 2001
Posts: 5,114
Why does this work? Why does this show the email address?

#1

Code:
<?php
class person {
    private $email = ?foo?;
    function showEmail() {
        echo $this->email;
    }
}
class user extends person {}
$u = new user();
$u->showEmail();


but this doesn?t?

#2

Code:
<?php
class person {
    private $email = ?foo?;
}
class user extends person {
    function showEmail() {
        echo $this->email;
    }
}
$u = new user();
$u->showEmail();
Also, why does this work

#3

Code:
<?php
class person {
    private $email = ?foo?;
    function showEmail() {
        echo $this->email;
    }}
class user extends person {
    function showEmail() {
        parent::showEmail();
    }
}
$u = new user();
$u->showEmail();

__________________
ICQ 115433750
KRosh is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote