in reply to Re^3: Simple inheritance question
in thread Simple inheritance question
I guess this is starting to seem a little finnicky, but I would like to use test() as if it were a function internal to Two, not requiring an object.#!/usr/bin/perl -w use strict; { package One; sub test { my $x = pop; print "$x\n"; } } { package Two; use base "One"; sub new { my $self = {}; bless($self); } sub eg { my $self = shift; $self->test(pop); } } my $obj = new Two(); $obj->eg("hello");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Simple inheritance question
by BrowserUk (Patriarch) on Apr 23, 2010 at 21:09 UTC | |
|
Re^5: Simple inheritance question
by ikegami (Patriarch) on Apr 23, 2010 at 20:40 UTC | |
|
Re^5: Simple inheritance question
by webfiend (Vicar) on Apr 23, 2010 at 17:12 UTC | |
by chromatic (Archbishop) on Apr 23, 2010 at 19:36 UTC |