By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,046 Members | 1,200 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,046 IT Pros & Developers. It's quick & easy.

Object delegation possible in PHP4?

P: n/a

Perhaps I'm using the wrong terminology, but is object delegation (as
opposed to inheritance) possible?, i.e. the line

in the example below.

E.g. if one were to call

# Instantiate a new helpdesk
$helpdesk = new helpdesk ('theUsername', 'thePassword');

# Check
$helpdesk->checkUserStatus ();

why does this not give the result:


Or do I just need some sort of other syntax?

# Define a helpdesk application class
class helpdesk
# Constructor
function helpdesk ($username, $password)
# Instantiate a registration
$this->registration = new registration ($username, $password)

# Do more stuff in this constructor

# Some other function
function checkUserStatus ()
# Define a registration class which applications can use
class registration
# Constructor
function registration ($username, $password)
// Validation of username & password at doCheck
$this->registered = (doCheck);

# Another function
function displayStatus ()
echo ($this->registered ? 'Registered' : 'Not registered');

Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
In article <Pi*******************************>,
Martin Lucas-Smith <mv***> wrote:

Without following everything line by line, so I could be wrong here, but
could it simply be that you need to do:


i.e. () obligatory with a method call?


Sorry, <de*****> is een "spam trap".
E-mail adres is <jpk"at">, waarbij "at" = @.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.