To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > Upgrading PHP

Upgrading PHP Issues concerning PHP version upgrades and future releases

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-08-2004, 12:03 PM   #1
WinSeb
Junior Member
 
Join Date: Jul 2004
Location: France
Posts: 2
A member variables Wich are a instance of an other class

Hello
I 've got a little question :

I have one class: food and an other : meal .

In my class food I 'd like to declare a member variables : meal1 wich are an instance of meal (meal meal1=new meal (); ).

The problem is that the 2 classes (food and meal ) are not in the same file so the meal's constructor is unknwon of food .

Is there anything that I cando except include (meal.class.php) ???

Thanks
Have a nice day
SEB
WinSeb is offline   Reply With Quote
Old 07-08-2004, 09:25 PM   #2
planetsim
code | beer > sleep
 
Join Date: Sep 2002
Location: aus
Posts: 4,826
Well that is the only way. If the class isnt included even if you made the class PHP isnt going to be able to find and and throw a Undefined Object at you.
__________________
Dont be lazy Search
And use the Manual
Webmobo - Open Source News Script | Portfolio / Blog | Against TCPA
planetsim is offline   Reply With Quote
Old 07-08-2004, 11:11 PM   #3
Moonglobe
Better fan than rebelo!
 
Moonglobe's Avatar
 
Join Date: Apr 2003
Location: brain://localhost:left-side
Posts: 2,381
declare a global function
PHP Code:
__autoload($classname) { }
with all the required code to load any class passed to it. then, when an unknown class is encountered, PHP will automatically call the function.
__________________
there's no place i can be, since i found serenity.
Moonglobe is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 07:51 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.