new to oop in PHP 4....
Posted: Tue Aug 19, 2008 3:42 pm
I am very new to oop in PHP.
I have a World class that has a User object as a member.
I declare it as:
...and instantiate it in the constructor:
In this function (from the World class) I am returning a member of the User class:
But it tells me that Fatal error: Call to a member function getUserdata() on a non-object.. Do I have to declare $mainUser as an object or something??
I have a World class that has a User object as a member.
I declare it as:
Code: Select all
[b]var $mainUser;[/b]Code: Select all
[b]$mainUser = new User();[/b]Code: Select all
function data(){
return $this->mainUser->getUserdata();
}