in reply to (dws)Re: OO vs. global variables...
in thread OO vs. global variables...
So, in the Point class, you'd have a function that sorta looks like:
I suppose that would make sense, as a Point should not know all about the intricacies of Board layout. For example, I can think of several games (Risk comes to mind) where two Points would be next to one another, but there is no algorithmic way of determining that. So, I suppose the Board should determine next-to-ness.package Point; # Stuff here... sub isNextTo { my $self = shift; my $newPoint = shift; return $self->{PARENT}->Point_isNextTo($self, $newPoint); } # Stuff here...
*frowns* Does that mean that the Board should be able to dip into the Point's inner workings and get its X and Y coordinates? How would this work without using an accessor function?
------
We are the carpenters and bricklayers of the Information Age.
Vote paco for President!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: (dws)Re: OO vs. global variables...
by dws (Chancellor) on Sep 04, 2001 at 22:40 UTC | |
by dragonchild (Archbishop) on Sep 04, 2001 at 22:55 UTC |
In Section
Seekers of Perl Wisdom