in reply to Re^2: OO, inheriting functions from other packages
in thread OO, inheriting functions from other packages
Then you have a calendar as a data element of your DB class, and you can do things like:package MyDBClass; use MyCalendar; sub new { my $class = shift; ... my $self = ...; ... $self->{'_calendar'} = MyCalendar->new(); ... return bless $self, $class; } sub Calendar { return $self->{'_calendar'}; } ...
Now there are other, more sophisticated ways to deal with the calendar in the DB, but this should illustrate the point.my $db = MyDBClass->new(); $db->Calendar()->CalendarFunction(...);
The moral is, if a class wants some other packages functionality, it doesnt have to be a child class, it can just use the other class.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: OO, inheriting functions from other packages
by jeffa (Bishop) on Jul 22, 2004 at 23:21 UTC |