天天看点

Playing with cubes II

Hey Codewarrior!

You already implemented a Cube class, but now we need your help again! I'm talking about constructors. We don't have one. Let's code two: One taking an integer and one handling no given arguments!

Also we got a problem with negative values. Correct the code so negative values will be switched to positive ones!

The constructor taking no arguments should assign 0 to Cube's Side property.

​​http://www.codewars.com/kata/playing-with-cubes-ii/csharp​​

可以使用this来处理构造函数,无参构造函数,字段的默认值,可以通过调用有参函数来处理

赋值的时候,可以调用类本身的函数

可以使用函数的缺省参数