1.10 Objects and classes
Let’s return to cooking. I recently ran out of bay leaves in our kitchen. Bay leaves are used to flavor many foods, most notably soups, stews, and other braised meat dishes. Okay, I thought, I’ll just order some bay leaves online. I found four varieties:
- Turkish or Mediterranean bay leaves, from the Bay Laurel tree,
- Indian bay leaves,
- California bay leaves, and
- Caribbean bay leaves.
I eventually discovered that what I wanted was Turkish bay leaves. I ordered six ounces. When they arrived, I realized that I had enough to last the rest of my life.
Let’s get back to the varieties. While numbers and strings are built into most programming languages, bay leaves most certainly are not. Nevertheless, I want to create a structure to represent bay leaves in a first-class way. Perhaps I’m building up a collection of ingredient ...