Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public prefix func ++ (vector: inout Vector3D) -> Vector3D {
- vector += Vector3D(x: 1.0, y: 1.0, z: 1.0)
- return vector
- }
- var toIncrement = Vector3D(x: 1.0, y: 2.0, z: 3.0)
- let afterIncrement = ++toIncrement
- /* Since the operator parameter is inout, toIncrement now has: x = 2, y = 3, z = 4 */
- // afterIncrement also has: x = 2, y = 3, z = 4 */
Add Comment
Please, Sign In to add comment