This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html Set by lizmat on 8 June 2022. |
|||
deoac | How do you reference a parent attribute with the same name from an inherited object? | 00:52 | |
class A { has $.foo = 1}; | |||
class B is A { has $.foo = 2}; | 00:54 | ||
my $b = B.new; | |||
say $b.foo; # 2 | |||
say $b.A.foo; # error; | |||
How do I get that last statement to output '1'? | |||
guifa | deoac: by namespacing the method call | 01:23 | |
m: class A { has $.x = 1 }; class B is A { has $.x = 2 }; my $c = B.new; say $c.x; say $c.A::x; | |||
camelia | 2 1 |
||
guifa | but that feels pretty code smelly (with methods less so, admittedly) | 01:24 | |
02:12
frost joined
02:52
frost left
03:12
frost joined
08:02
Kaipei is now known as Kaiepi
08:27
deoac left
14:56
frost left
18:40
deoac joined
|