Hello PerlMonks,
I have a quick question on inheritance. Here is the my super class.
Package EventHandler;
sub new {
my $class = shift;
my $self = {
EVENT_ID => $event_count,
EVENT_CAT => shift,
EVENT_STATUS => "current",
EVENT_COMPONENT => undef,
EVENT_START_TIME => undef,
EVENT_END_TIME => undef,
EVENT_STATE => "Unknown",
EVENT_START_LOCATION=> undef,
EVENT_END_LOCATION => undef,
EVENT_RECOVERED_BY => undef,
};
bless( $self, $class );
$event_count++ ;
return $self;
}
I have a sub class DeviceEventHandler which inherits the above EventHandler module.
I create object using DeviceEventHandler ->new() which will call the super class method.
Now my question is how do i add some sub class specific attributes say "DeviceReset" in DeviceEventHandler and instantiate it during object creation.
For that purpose I need to define a "new" method in DeviceEventHandler module which will in turn call the "new" method of the super class.
Please help me out on this..
Thanks.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.