<remarks>       <list>       <returns>

Using the Point class definition, insert the XML comments highlighted in the following code:

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

namespace PointClass {

 /// <summary>

 /// The Point class contains 2 properties, 1 overloaded

 /// constructor, and 1 overloaded method

 /// </summary>

 /// <remarks>

 /// If you need to use the Point class in the System.Drawing

 /// namespace, be sure to reference it using the fully

 /// qualified name, i.e. System.Drawing.Point

 /// </remarks>

 /// <history>

 /// [Wei-Meng Lee] 5/12/2008 Created

 /// </history>

 public class Point {

  //---static variable---

  private static int count;

  //---properties---

  /// <summary>

  /// Property for x-coordinate

  /// </summary>

  /// <returns>

  /// The x-coordinate

  /// </returns>

  public int x { get; set; }

  /// <summary>

  /// Property for y-coordinate

  /// </summary>

  /// <returns>

  /// The y-coordinate

  /// </returns>

  public int y { get; set; }

  //---constructors---

  /// <summary>

  /// Default constructor

  /// </summary>

  /// <remarks>

  /// Creates a new instance of the Point class

  /// </ remarks>

  public Point() {

   count++;

  }

  /// <overloads>

  /// Constructor

  /// </overloads>

  /// <summary>

  /// Constructor with two parameters

  /// </summary>

  /// <param name='x'>Parameter x is assigned to the x- coordinate</param>

  /// <param name='y'>Parameter y is assigned to the y- coordinate</param>

  /// <remarks>

  /// Creates a new instance of the Point class

  /// </remarks>

  public Point(int x, int y) {

   this.x = x;

   this.y = y;

   count++;

  }

  //---overloaded methods---

  /// <overloads>

  /// Calculates the distance between two points

  /// </overloads>

  /// <summary>

  /// Calculates the distance of a point from the origin

  /// </summary>

  /// <returns>The distance between the current point and the origin

  /// </returns>

  /// <example>This sample shows how to call the <c>length() </c>

  /// method

  /// <code>

  /// Point ptA = new Point(3, 4);

  /// double distance = ptA.Length();

  /// </code>

  /// </example>

  public double Length() {

   return Math.Sqrt(

    Math.Pow(this.x, 2) + Math.Pow(this.y, 2));

  }

  /// <summary>

  /// Calculates the distance of a point from another point

  /// </summary>

  /// <param name='pt'>A Point object</param>

  /// <returns>The distance between the current point and the

  /// specified point

  /// </returns>

  /// <example>This sample shows how to call the <c>length()</c>

Вы читаете C# 2008 Programmer's Reference
Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату
×