天天看點

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來處理構造函數,無參構造函數,字段的預設值,可以通過調用有參函數來處理

指派的時候,可以調用類本身的函數

可以使用函數的預設參數