Thanks for all the help thusfar. Classes are just not something I am
understanding. I have read the sections on classes in several books and the
www.php.net section on them and still am missing something. It seems that
these books have been telling me what a light switch is used for but not how
to use one.
So would I call the class like this?
$first = new first;
$first->setData(35, "chris");
$test=$first->returnData;
print $test;
Thanks again,
Leonard.
Just as a refresher here is the class.
class first
{
var $age;
var $name;
function first()
{
$age = 0;
$name = '';
}
function setData( $age, $name )
{
$this->age = $age;
$this->name = $name;
}
function returnData()
{
$retval = '';
$retval = $this->age;
$retval .= $this->name;
return $retval;
}
}
-----Original Message-----
From: Johannes Schlueter [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 03, 2003 2:59 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Help with classes (oop)
On Monday 03 February 2003 20:45, Chris Boget wrote:
> function setData( $age, $name )
> {
> $age = $age;
> $name = $name;
> }
Is useless ;-) I think you wanted this:
function setData( $age, $name )
{
$this->age = $age;
$this->name = $name;
}
johannes
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php