Objective: Plug & chug, ~3 minutes: “is a” versus “has a” — the last OOP idea you need for this framework.
⏱ ≈14 min full lesson · Converted from the O-04 module deck · English edition — Español · العربية · বাংলা in translation
Plug & chug, ~3 minutes: “is a” versus “has a” — the last OOP idea you need for this framework.
Inheritance: “is a”: INHERITANCE: one class is a special version of another — class PrivacyPage extends BasePage inherits everything BasePage has. Powerful, but tightly coupled: change the parent, and every child feels it.
Composition: “has a” — the framework's choice: COMPOSITION: a class is built from parts — HomePage HAS A Header component, shared by every page. Change the header in one place; every page gets it. This framework prefers composition (you'll see why in A-01).
Plug & chug: tree or LEGO?: Inheritance is a family tree — traits flow down and can't be handed back. Composition is LEGO — swap one brick, keep the model. When the header changes, which model do you want to be holding?
OOP track complete: classes, objects, properties, constructors, methods, composition. Page Objects (B-05) hold no mysteries for you now.