Luke wrote:

Okay, I seriously have to see an example of a submethod in use.


    class Driver::Qualified {
        method drive {
            print "Brrrm brrrm!"
        }
    }

    class Driver::Disqualified is Driver {
        submethod drive {
            die .name(), " not allowed to drive"
        }
    }

    class Driver::Requalified is Driver::Disqualified {}

    my Driver $preDUI  = Driver::Qualified.new();
    my Driver $perDUI  = Driver::Disqualified.new();
    my Driver $postDUI = Driver::Requalified.new();

    $preDUI.drive();   # calls &Driver::Qualified::drive
    $perDUI.drive();   # calls &Driver::Disqualified::drive
    $postDUI.drive();  # calls &Driver::Qualified::drive

Damian



Reply via email to