Associated Functions & Methods

# Introduction In this lab, we define a Point struct with associated functions origin() and new(), and a Rectangle struct with methods area(), perimeter(), and translate(). We also introduce a Pair struct with a method destroy(). We demonstrate how to use these functions and methods by creating instances of the structs and calling the respective functions and methods on them. > **Note:** If the lab does not specify a file name, you can use any file name you want. For example, you can use `main.rs`, compile and run it with `rustc main.rs && ./main`.

|60 : 00

Click the virtual machine below to start practicing