Re: [PHP] OOP, dynamic class extention
From: Jough Jeaux (phpjough_at_yahoo.com)
Date: 10/30/03
- Next message: Marek Kilimajer: "Re: [PHP] OOP, dynamic class extention"
- Previous message: Kevin Stone: "RE: [PHP] removing all duplicate values from an array"
- In reply to: Jackson Miller: "OOP, dynamic class extention"
- Next in thread: Marek Kilimajer: "Re: [PHP] OOP, dynamic class extention"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Oct 2003 10:28:42 -0800 (PST) To: Jackson Miller <jackson@coldfeetcreative.com>, php <php-general@lists.php.net>
Shouldn't this line:
class my_child_class extends MY_BASE_CLASSFILE {
Read like this:
class my_child_class extends MY_BASE_CLASS {
After all "base_class.php" isn't the name of your class, "base_class" is.
Jackson Miller <jackson@coldfeetcreative.com> wrote:
I want to be able to set a base class in a settings file, and then have other
classes extend the base class, but PHP won't let me do what I have tried.
I get the following error:
Fatal error: Class cepweb: Cannot inherit from undefined class my_base_class
in /home/me/my_child_class.php on line 10
ex:
// settings to be set on install of the app
define("MY_BASE_CLASS","base_class");
define("MY_BASE_CLASSFILE","base_class.php");
// require the class file
require_once(MY_BASE_CLASSFILE);
class my_child_class extends MY_BASE_CLASSFILE {
// yada yada
}
?>
Any thoughts on ways to overcome this?
I have tried using a variable instead of a constant, but it didn't work.
-Jackson
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --------------------------------- Do you Yahoo!? Exclusive Video Premiere - Britney Spears
- Next message: Marek Kilimajer: "Re: [PHP] OOP, dynamic class extention"
- Previous message: Kevin Stone: "RE: [PHP] removing all duplicate values from an array"
- In reply to: Jackson Miller: "OOP, dynamic class extention"
- Next in thread: Marek Kilimajer: "Re: [PHP] OOP, dynamic class extention"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]