Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 24th, 2006, 5:03 PM   #11
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3 kruptof is on a distinguished road
i tried that and i am still getting the same error dawei
__________________
Quote:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old Oct 24th, 2006, 5:28 PM   #12
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
[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
DaWei is offline   Reply With Quote
Old Oct 25th, 2006, 7:19 AM   #13
kruptof
Professional Programmer
 
kruptof's Avatar
 
Join Date: May 2006
Location: UK - London
Posts: 330
Rep Power: 3 kruptof is on a distinguished road
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:
When I was young it seemed that life was so wonderful,a miracle, oh it was beautiful, magical.
Now watch what you say or they'll be calling you a radical,a liberal, oh fanatical, criminal. Oh won't you sign up your name,we'd like to feel you're acceptable, respectable, oh presentable, a vegetable
kruptof is offline   Reply With Quote
Old Oct 25th, 2006, 7:54 AM   #14
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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

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 On
HTML code is Off
Forum Jump

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




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:56 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC