APDR

Classes and Inheritance Lab

Algorithms, Programming, and Data Representation · Module 92313 · Chapter 11

Predict first, then reveal how Python handles attributes, inherited methods, parent constructors, shared IDs, and Rabbit operators.

How the lab works

  1. Predict. Choose an answer and confidence.
  2. Reveal. Follow the class lookup and state changes.
  3. Explore. Change the example after the fixed challenges.

11.1–11.3 Animal objects

Trace instance data, accessors, and a default argument.

The class and object trace appears here.

Or explore

11.2 Getters and setters

Compare a stable method interface with direct field access.

The class and object trace appears here.

Or explore

11.4 Inheritance and lookup

Follow a method request up the superclass chain.

The class and object trace appears here.

Or explore

11.5 Constructors and overrides

Trace parent initialisation and the nearest method override.

The class and object trace appears here.

Or explore

11.6 Class variables and IDs

Watch a shared counter assign a separate ID to each instance.

The class and object trace appears here.

Or explore

11.7 Rabbit operators

Predict Rabbit addition and symmetric parent equality.

The class and object trace appears here.

Or explore

Your results

Based on the Chapter 11 guide and supplied lecture slides, rewritten in my own words. Not an official FAU publication. Made by Thanate Amornjiraporn (Focus).