コード例 #1
0
 /// <summary>
 /// Constructor of an apple class. If nothing is specified, creates a random characteristics.
 /// </summary>
 /// <param name="color">Color of an apple. Red by default.</param>
 /// <param name="size">Size of an apple. Cherry by default.</param>
 /// <param name="taste">Taste of an apple. Bitter by default.</param>
 /// <param name="rotteness">Rotteness of an apple. Fresh by default.</param>
 public Apple()
 {
     this.color     = (Color)rand.Next(0, Enum.GetNames(typeof(Color)).Length);
     this.size      = (Size)rand.Next(0, Enum.GetNames(typeof(Size)).Length);
     this.taste     = (Taste)rand.Next(0, Enum.GetNames(typeof(Taste)).Length);
     this.rotteness = (Rotteness)rand.Next(0, Enum.GetNames(typeof(Rotteness)).Length);
 }
コード例 #2
0
 /// <summary>
 /// Constructor of an apple class. If nothing is specified, creates a random characteristics.
 /// </summary>
 /// <param name="color">Color of an apple. Red by default.</param>
 /// <param name="size">Size of an apple. Cherry by default.</param>
 /// <param name="taste">Taste of an apple. Bitter by default.</param>
 /// <param name="rotteness">Rotteness of an apple. Fresh by default.</param>
 public Apple(Color color = Color.Red, Size size = Size.Cherry, Taste taste = Taste.Bitter, Rotteness rotteness = Rotteness.Fresh)
 {
     this.color     = color;
     this.size      = size;
     this.taste     = taste;
     this.rotteness = rotteness;
 }