It sounds like you're taking the wrong approach. One of the selling points of inheritance is that your child classes behave just like the parent classes (at least interface-wise), and are therefore interchangeable (polymorphism).
If you're looking to simplify the interface to the base class, I wouldn't use inheritance at all. Make a new class as a wrapper around the more complicated class, sort of like the facade design pattern.
Example:
package ComplicatedClass; sub new { my $class = shift; return bless {}, $class; } sub method1 { print "This is method 1\n"; } sub method2 { print "This is method 2\n"; } .. sub method99 { print "This is method 99\n"; } sub method100 { print "This is method 100\n"; } package SimpleClass; sub new { my $class = shift; my $cc = new ComplicatedClass; return bless { cc => $cc }, $class; } sub method1 { my $self = shift; $self->{cc}->method1; } sub method42 { my $self = shift; $self->{cc}->method42; } sub method99 { my $self = shift; $self->{cc}->method99; } package main; my $obj = new SimpleClass; $obj->method1; $obj->method42; $obj->method99; $obj->method2; # Can't locate object method "method2" via package "Sim +pleClass"
In reply to Re: Inherit only few methods from a parent class
by lostjimmy
in thread Inherit only few methods from a parent class
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |