TUTORIAL · STEP 4 OF 7
Structs and enums
The public fields of a struct become properties, and every member of an enum is there by name.
new Module.Point() creates a Point, whose x and y read and write like any property. step takes the point by value, so C++ works on a copy and returns a new point.
The members of enum class Direction are Module.Direction.North, Module.Direction.East and so on. They pass straight into C++, and a member that comes back is the same object, so === compares them.
Only public members bind; whatever is private stays inside C++.
Try it
Add Direction turnLeft(Direction direction); and walk the square the other way round.