UML Class Diagram
Rectangle
- w: int
- h: int
+ __init__(w, h)
+ area(): int
Create a Rectangle object with width and height, then call its area() method to compute the area.
Create Rectangle(w, h). area() multiplies the stored sides.
A Rectangle has width and height properties. The area() method multiplies them: width × height.
Calculate area for architecture, game graphics, land plots, or UI layouts. Instead of writing 3 * 4 = 12 every time, wrap it in a reusable class.