Course of Raku / Objects, I/O, and exceptions / Classes and objects / Attributes / Exercises

A book

Problem

Define a class Book with two attributes, title and author. Create a book with the title Raku and the author Larry, then print a single citation line that uses both accessors, in the form <title> by <author>.

Example

The program prints:

Raku by Larry

Solution

See the solution

Course navigation

Solution: A counter   |   Solution: A book