instantiating one class in another class...
Posted: 23. June 2009 07:15
i have 2 class.
1st class--
2nd class---
now when i try to execute the second class i am getting the following error--
Parse error: parse error, expecting `T_FUNCTION' in F:\xampp\htdocs\Object\Cloning\phpdesigner_tmp24.php on line 20
Note- to import the first class i have also used include(); but getting the same error..
Thank u...
1st class--
- Code: Select all
<?php
class CloneDemo1
{
private $employeeid;
private $tiecolor;
function setEmployeeId($empid)
{
$this->employeeid = $empid;
}
function getEmployeeId()
{
return $this->employeeid;
}
function setTieColor($tcolor)
{
$this->tiecolor = $tcolor;
}
function getTieColor()
{
return $this->tiecolor;
}
}
?>
2nd class---
- Code: Select all
<?php
require_once("CloneDemo1.class.php");
class TestCloneDemo1
{
$cloneObj1 = new CloneDemo1();
$cloneObj1->setEmploeeId(15264);
$cloneObj1->setTieColor("Black");
printf("Employee id:%d<br />", $cloneObj1->getEmployeeId());
printf("Employee tie color:%s<br />", $cloneObj1->getTieColor());
}
?>
now when i try to execute the second class i am getting the following error--
Parse error: parse error, expecting `T_FUNCTION' in F:\xampp\htdocs\Object\Cloning\phpdesigner_tmp24.php on line 20
Note- to import the first class i have also used include(); but getting the same error..
Thank u...