Variable overloading issue in PHP
Thanks for visiting my post.
I have a issue in object inheritance in php. I have two classes which extends other. There is one common variable name used in both the class. So it's creating a conflict while accessing the parent class variable. Let me explain this by example
// First Class
class a {
public $email = "a@a.com";
}
class b extends a {
public $email = "b@b.com";
}
$obj = new b();
echo $obj->email; // this will print b@b.com but i want to print a@a.com
-
CMartin -
Thanks
{{ DiscussionBoard.errors[906973].message }} -
-
titleless Banned{{ DiscussionBoard.errors[912749].message }}-
amber.long83 -
Thanks
{{ DiscussionBoard.errors[913385].message }} -
-