Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 691 Bytes

playing_with_cubes_i.md

File metadata and controls

24 lines (20 loc) · 691 Bytes

Description

Create a public class called Cube without a constructor which gets one single private integer variable Side, a getter GetSide() and a setter SetSide(int num) method for this property. Actually, getter and setter methods are not the common way to write this code in C#. In the next kata of this series, we gonna refactor the code and make it a bit more professional...

Notes:

  • There's no need to check for negative values!
  • initialise the side to 0.

My Solution

class Cube
  def get_side
    @side.to_i
  end

  def set_side(side)
    @side = side
  end
end