#!/usr/bin/perl use warnings; use strict; use Base; use Inherit; my $base = Base->new(); $base->text("hello"); print $base->text . "\n"; my $inherit = Inherit->new(); $inherit->text("howdy"); print $inherit->text . "\n"; $base->secret("secret"); print $base->secret . "\n"; # this will get us an error saying private method #$inherit->inheritSecret("verySecret"); #print $inherit->inheritSecret . "\n"; # impossible to access protected directly #$inherit->protected("notsosecret"); #print $inherit->protected . "\n"; # access to NOTSOSECRET by means of a protected method $inherit->inheritNotSoSecret("notsosecret"); print $inherit->inheritNotSoSecret . "\n";