18. Python Chapter 7 — object-oriented programming - revision mindmap

All mindmaps · Full chapter · Practice answers

Detailed six-branch revision mindmap for Python Chapter 7 — object-oriented programming

Open full-resolution image · Printable collection - page 18

The map is a completed revision summary. Cover a branch and reconstruct it, then try the linked chapter practice. Read the image at full size when labels are small.

Text version

Object model

  • Class versus object/instance
  • Attributes store state
  • Methods define behaviour
  • self is receiving instance, not an attribute

Construction and state

  • init initialises instance
  • Instantiate then call methods
  • Instance state versus class attributes
  • Mutable class-level value can be shared unintentionally

Encapsulation

  • Group state with operations
  • Controlled access through interface
  • Getter reads; setter validates
  • Python name mangling is not an impenetrable barrier

Inheritance

  • Is-a relationship; distinguish has-a
  • Superclass shared members
  • Subclass specialised members
  • super initialisation and method reuse

Polymorphism and diagrams

  • Same method call, type-appropriate implementation
  • Override a method and show concrete behaviour
  • Class compartments: name, attributes, methods
  • Visibility, types/signatures; inheritance arrow toward superclass

Worked example & exam traps

  • Account A: balance 10; Account B: balance 20.
  • A.deposit(5) → A.balance 15; B.balance stays 20 with instance state.
  • Subclass overrides a method: the same call can select different behaviour.
  • Avoid: duplicate inherited state; missing base initialisation; methods changing wrong object

Sources and reading

This map condenses Chapter 18 and its source trail. Use the self-learning reading guide for the corresponding VJC pages and A notes. It does not add topics to the stated promo scope.