In Glossary§
See primary documentation in context for Instance
An instance of a class is also called an object in some other programming languages. It has storage for attributes and is often the return value of a call to a method called new
, or a literal.
Instances of most types are defined to be True
e.g., defined($instance)
is True
.
my Str = "hello"; ## this is with built-in types, e.g. Strif defined()else## if you wanted objects...my = A.new;say .defined.raku;# defined($an_instance) works too.
To put things another way, a class contains the blueprints of methods and attributes, and an instance carries it into the real world.