Class Constructor
Posted: Tue Jan 04, 2005 5:32 pm
Hi
The expected output from the following code is 1,2
The actual output I am getting is 2,2
Your help would be appreciated.
Thanks,
-sl
feyd | Help us, help you. Please use
The expected output from the following code is 1,2
The actual output I am getting is 2,2
Your help would be appreciated.
Thanks,
-sl
Code: Select all
class test {
var $a;
var $b;
function test() {
$this->setA(1);
$this->setB(2);
}
function getA() { return $this->$a; }
function setA($p_a) { $this->$a = $p_a; }
function getB() { return $this->$b; }
function setB($p_b) { $this->$b = $p_b; }
}
$testobj = new test();
echo $testobj->getA().",".$testobj->getB();feyd | Help us, help you. Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: :arrow: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]