# New Ticket Created by Philippe de Rochambeau
# Please include the string: [perl #112676]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=112676 >
Hello,
neither the *WALK... or SUPER... lines below seem to work.
I am trying to use the superclass's set method.
Best regards,
pr
--------------------
class cell {
has Int $.contents is rw = 0;
method get() {
return $.contents;
}
method set(Int $n) {
$.contents = $n;
}
}
class reCell is cell {
has Int $.backup is rw = 0;
method set(Int $n) {
$.backup = $.contents;
*WALK[:super]::set($n);
#SUPER::set($n);
}
method restore() {
$.contents = $.backup;
}
}
my $reCell = reCell.new(contents => 1);
say "reCell's contents 1 = $reCell.get()";
$reCell.set(12);
say "reCell's contents 2 = $reCell.get()";
$reCell.restore();
say "reCell's contents after restore = $reCell.get()";