Hi Laurent, I get: Fruitstand in Fruit<140431957910656>.location has Fruit<140431957910656>.apples apples.
[Rakudo v2020.10] Best, Bill. On Fri, Dec 18, 2020 at 5:29 AM Laurent Rosenfeld via perl6-users < perl6-us...@perl.org> wrote: > Hi Todd, > > 1. Yes, a class is a blueprint for manufacturing objects, you can > construct as many object as you want. > > 2. As an example, you can try: > > say " Fruitstand in $FruitStand.location has $FruitStand.apples apples."; > > 2. As you declared your class the object attributes will not be mutable. > But if you had declared the apple attribute like so in the class: > > has UInt $.apples is rw; > > then you could write: > > $FruitStand.apples += 42; > > Cheers, > Laurent. > > Le ven. 18 déc. 2020 à 08:12, ToddAndMargo via perl6-users < > perl6-us...@perl.org> a écrit : > >> Hi All, >> >> class Fruit { >> has Str $.location; >> has UInt $.apples; >> has UInt $.oranges; >> has UInt $.bananas; >> } >> >> my $FruitStand = Fruit.new( location => "Cucamonga", >> apples => 400, >> oranges => 200, >> bananas => 50 ); >> >> 1) am I correct that I can make as many objects as I >> want out of a particular class? >> >> 2 ) what is the syntax to read an element inside an >> object? >> >> 3) what is the syntax to write to an element inside an >> object? >> >> I am confused, again. >> >> -T >> >