in reply to Inheritance and objects tied to a database

Some of your concept about OO is wrong.

When you change some variables in the child OBJECT, will the change be reflected in the parent OBJECT? The question is invalid.
  1. Bad news first. Some concept is really wrong here. There is no parent OBJECT at all. When you instantiate your child class, you got an OBJECT, which is an instance of your child class, which is a sub class of its parent class. There is only one OBJECT.
  2. but the good news is that, this OBJECT does contain the variables you defined in both of the child class and its parent class (The fact is simplified, but for most Perl classes, this is the case). So why do you worry?
  3. For variables (better call those attributes) you defined in the parent class/package should be visible to the child class/package, then make it part of your $self, or can be ref'd from $self.

  • Comment on Re: Inheritance and objects tied to a database

Replies are listed 'Best First'.
Re: Re: Inheritance and objects tied to a database
by relax99 (Monk) on Dec 20, 2002 at 20:06 UTC
    Thank you! I think your answer helped me clarify my understanding of what's going on quite a bit. Now I do see where I made a conceptual error here.