The designer reports every card in the app has collapsed to a dot. QA confirms: any Rect has area zero. The code 'looks fine', review passed, nobody wrote constructor tests — it's a constructor, what could possibly break. w = w, that's what. The parameter shadowed the member. Fix it — and turn on -Wshadow while you're at it.
The constructor parameters w and h shadow the members with the same names — w = w assigns the parameter to itself and the members stay 0. Every Rect has area 0. Fix the constructor; the member initializer list is the idiomatic tool.
area() returns width × height-Wall -Wshadoww = w; inside the buggy constructor, which w is on each side, and why?-Wshadow not enabled by -Wall, and what is the cost of leaving it off?Rename the parameters (width, height) and initialize the members in the initializer list: Rect(int width, int height) : w(width), h(height) {}.
Hit Submit (or ⌘/Ctrl + ↵) — test results will show up here.