classes confusion
- From: Ed Koren <ed@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 28 Apr 2005 14:03:20 -0400
Hi there,
I have used classes in simplified form for a while, but I want to take things a step further to really take advantage of inheritance. I am having trouble accessing members of parent classes, in child classes.
Example:
class siteConfig {var $foo = "bar";
function getSettings() {// Fill settings array return $settings; } }
class dbConnect extends siteConfig { function dbConnect() {
$settings = parent::getSettings();
// connect to database
}
}class userSession extends dbConnect {// Contains session_start, authentication and session_destroy
}
I cannot seem to figure out how to access var $foo (defined in siteConfig class) in the userSession class. I would like to access some config variables outside the class too, through an instance of the userSession class. I read that a class can only have one parent in PHP, does this mean you cannot stack more than two classes on top of each other?
Thanks for any advice. I apologise if my explanation is a bit vague, that's due to my own confusion.
Ed
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups ----= East and West-Coast Server Farms - Total Privacy via Encryption =---- .
- Follow-Ups:
- Re: classes confusion
- From: Henk Verhoeven
- Re: classes confusion
- Prev by Date: Re: Page works when Form Action is Get but not Post
- Next by Date: Re: classes confusion
- Previous by thread: mySQL accessed remotely
- Next by thread: Re: classes confusion
- Index(es):