roehrich@cray.com (Dean Roehrich)
Re: searching the @ISA tree
Re: searching the @ISA tree
Cray Research, Inc.
10 May 96 14:39:54 CDT
- Newsgroups:
- comp.lang.perl.misc
- References:
- <4mr8p2$kmk@csnews.cs.colorado.edu>
In article ,
Dave Disser wrote:
>Hum. Ok, here's how this came up. I've written class A which expects
>all of the values in its hash to be of class B. When I make class C a
>superclass of class A, it adds scalar values to the instance. What do
>the o-o gurus say about dealing with stuffing everything into the same
>name space?
This isn't called namespace stuffing. This is called making a class.
When you create class C as a subclass of class A you do not end up with a
class C: you end up with a class C which is a subclass of class A. When you
instantiate class C you get something which has the state and behavior
described by both class C and class A (basically). So if A has instance
variables Z and Y and methods Eat and Sleep, and C has instance varables X
and W and methods Run and Play, then an instance of class C (which is a
subclass of A) will have state of Z, Y, X, and W and behavior of Eat, Sleep,
Run, and Play.
Dean
roehrich@cray.com