class member's altering problem
Posted: Fri Mar 17, 2006 4:13 am
feyd | Please use
so in class B i want to concat the string "From Class B" in the variables $defined ,and $undefined ,but giving errors.
please solve it or Suggest a solution to alter the variables....
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi Experts ,
I have a problem .below is code.......Code: Select all
class A{
var $defined="This is defined";
var $undefined="This is undefine";
function foo(){
if(isset($this)){
print $this->defined;
}
else print $this->undefined;
}
}
class B extends A{
function bar(){
A::foo();
$this->defined.="From Class B";
$this->undefined.="From Class B";
}
}
$a=new A();
$a->foo();
A::foo();
$b=new B();
$b->bar();
B::bar();
?>please solve it or Suggest a solution to alter the variables....
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]