Accessing other extended classes

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

Accessing other extended classes

Post by GeXus »

I have a setup, where there's a base class, then several classes that extend off of it... Is it possible to access the extended classes within another?

So for example, class Products extends Base and class Users extends Base... I want to access a function within the Users class within the Products class.....

Thanks!
Hieroglyphics
Forum Newbie
Posts: 13
Joined: Wed Jan 20, 2010 8:25 pm

Re: Accessing other extended classes

Post by Hieroglyphics »

No it is not possible but what you CAN do is.

Code: Select all

private $this->users;
 
public function __construct() {
    include_once('filethatcontainsusersclass.php');
    $this->users = new Users();
}
Then use like $this->users->functionfromusers()
GeXus
Forum Regular
Posts: 631
Joined: Sat Mar 11, 2006 8:59 am

Re: Accessing other extended classes

Post by GeXus »

Gotcha.. thanks! :)
Post Reply