# Ch 13: Inheritance

> Study guide to Crafting Interpreters chapter 13. Single inheritance: superclass declarations, method lookup through the chain, and super calls, finishing…

Updated October 20, 2026.

## Summary {#summary}

Crafting Interpreters chapter 13, Inheritance: Single inheritance: superclass declarations, method lookup through the chain, and super calls, finishing jlox. Budget about 5 hours; the book's `chap13_inheritance` tests check your code.

## Key facts {#key-facts}

- Week 11 of 145 on the cracked.guide path, in [Crafting Interpreters](https://cracked.guide/crafting-interpreters).
- Time budget: about 5 hours.
- Part of the book: jlox (tree-walk interpreter, Java).
- Verified on cracked.guide when the official `chap13_inheritance` tests pass on GitHub Actions.
- 3 challenges at the end of the chapter.
- Terms it teaches: [jlox](https://cracked.guide/glossary/jlox).

## Week 11 goals {#objectives}

By the end of week 11 you can:

- Implement superclass declarations and method lookup up the inheritance chain.
- Explain how `super` is bound through an extra environment.
- Recognize inheritance errors caught by the resolver or at runtime.

## This week's steps {#steps}

- Read the chapter: Implement, then run the full jlox test suite.
- Write the code in your lox repo: Type it into jlox/ (Java) yourself as you read, and get it running.
- Do the challenges (1–3): Challenge 3 (implement a feature you listed back in chapter 3) is the most rewarding.
- Push and let the tests verify it: Your repo runs the book's chap13_inheritance tests on every push; passing marks this done.

## Why it matters {#why}

Method resolution order and super are how every OO language reuses code. Finishing jlox is a real milestone.

## How to approach it {#approach}

Implement, then run the full jlox test suite. Celebrate, then take a day before starting C.

## Challenges {#challenges}

3 challenges at the end of the chapter.

Challenge 3 (implement a feature you listed back in chapter 3) is the most rewarding. Challenge 2 (BETA-style inner) comes back in chapter 29, so if you skip it now, expect to meet it again. Do challenges that change Lox's behavior on a separate git branch. The cracked.guide check runs the official test suite for this chapter, and a challenge that changes semantics (new syntax, different errors) can make tests fail on main.

## Common traps {#traps}

- A class inheriting from itself: make sure it is an error.
- super lookups must use the superclass of the class where the method was defined, not of the instance.

## Links {#links}

- [Read the chapter: Ch 13: Inheritance](https://craftinginterpreters.com/inheritance.html)
- [Official repo: book source, both interpreters, test suite](https://github.com/munificent/craftinginterpreters)
- [Running the official test suite against your own interpreter (repo README)](https://github.com/munificent/craftinginterpreters#testing-your-implementation)
- [Hacker News: Crafting Interpreters is available in print](https://news.ycombinator.com/item?id=27997167)

---

Source: https://cracked.guide/guide/ci-13
cracked.guide: A free, dated 145-week path to getting genuinely cracked at programming.
