On Mon, Jun 03, 2002 at 04:33:45PM -0400, Jared Boelens wrote:

> In my case i am trying to override a variable.  I have a property Username
> for both the parent and the child.  I am wondering if there is a way to
> differenciate between parent->Username and child->Username.

Are you talking about a child class that extends another parent class, 
or something similar?  Kind of like this:

   class FooParent {
      var $Username = '1';

   class FooChild extends FooParent {
      var $Username = '2';

   $F = new FooChild;
   echo $F->Username;

If so, then, no, I don't think there's a way to distinguish the two.  
The second instance will prevail.

To distinguish, you could create two separate object names...

   $F1 = new FooParent;
   $F2 = new FooChild;
   echo "$F1->Username and $F2->Username";

Or perhaps calling two instances of the class into separate object
names, then modify one instance of the Username variable...

   $F1 = new FooChild;
   $F2 = new FooChild;
   $F1->Username = '3';
   echo "$F1->Username and $F2->Username";

All depends on what you're trying to do.



               PHP classes that make web design easier
        SQL Solution  |   Layout Solution   |  Form Solution
    sqlsolution.info  | layoutsolution.info |  formsolution.info
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
 4015 7 Av #4AJ, Brooklyn NY     v: 718-854-0335     f: 718-854-0409

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to