![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3
![]() |
i tried that and i am still getting the same error dawei
__________________
Quote:
|
|
|
|
|
|
|
#12 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
[php]
<?php class thangy { public $ret = 0; public function testRet () { if ($ret == 0) echo "ret = 0<br/>"; else echo "ret != 0<br/>"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Fool thang</title> </head> <body> <?php $thisThang = new thangy (); $thisThang->testRet (); ?> </body> </html> [/php]
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#13 | |
|
Professional Programmer
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3
![]() |
i am not doing it that way the class and the script using the class are not on the same page. this would probaly would work but how comes it is not working when i include the class in another script, am i including it wronng, or maybe the fault is with some settings in the wamp server tool.
__________________
Quote:
|
|
|
|
|
|
|
#14 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Your code wasn't in a function. You seem to be missing the points. I put the class on the same page for simplicity's sake. An include does the same thing. But here, main file:
[php] <?php include "thangy.inc"; $thisThang = new thangy (); $thisThang->testRet (); ?> [/php] and "thangy.inc", [php] <?php class thangy { public $ret = 0; public function testRet () { if ($ret == 0) echo "ret = 0<br/>"; else echo "ret != 0<br/>"; } } ?> [/php] and output: ![]()
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Wierd compile Error. Need help please. | Keiyentai | Java | 7 | Aug 19th, 2006 1:35 AM |
| URL class | Eric the Red | Java | 5 | Jun 24th, 2006 9:01 PM |
| What is: "Oriented programming (OO)?" | BrinyCode | C++ | 12 | Nov 22nd, 2005 7:40 AM |
| User Input for Number Format | ericelysia1 | Java | 0 | Jul 21st, 2005 3:41 PM |
| Errors in microjava midlet | freddielj | Java | 1 | Apr 8th, 2005 11:02 AM |