Posted by phpCodeHead on 06/11/07 04:46
Code which should allow my constructor to accept arguments:
<?php
class Person {
function __construct($name)
{
$this->name = $name;
}
function getName()
{
return $this->name;
}
function printName()
{
print $this->name;
}
private $name;
}
$judy = new Person("Judy") . "\n"; // <- this is line parser don't
like
$joe = new Person("Joe") . "\n";
$judy->printName() . '<br />';
$joe->printName() . '<br />';
?>
Outputs:
Catchable fatal error: Object of class Person could not be converted
to string
Anyone seen this before? Know why? Am I missing something here?
Thanks all...
Gene Kelley
LAMP Web Developer
bizFlowDesigns.com
[Back to original message]
|