⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 point3.cs

📁 this is a good book for the visual c#
💻 CS
字号:
// Fig. 10.20: Point3.cs
// Point3 implements interface IShape and represents
// an x-y coordinate pair.
using System;

// Point3 implements interface IShape
public class Point3 : IShape
{
   private int x, y; // Point3 coordinates

   // default constructor
   public Point3()
   {
      // implicit call to Object constructor occurs here
   }

   // constructor
   public Point3( int xValue, int yValue )
   {
      X = xValue;
      Y = yValue;
   }

   // propertyX
   public int X
   {
      get
      {
         return x;
      }

      set
      {
         x = value;
      }
   }
      
   // property Y
   public int Y
   {
      get
      {
         return y;
      }

      set
      {
         y = value;
      }
   }

   // return string representation of Point3 object
   public override string ToString()
   {
      return "[" + X + ", " + Y + "]";
   }

   // implement interface IShape method Area
   public virtual double Area()
   {
      return 0;
   }

   // implement interface IShape method Volume
   public virtual double Volume()
   {
      return 0;
   }

   // implement property Name of interface IShape
   public virtual string Name
   {
      get
      {
         return "Point3";
      }
   }

} // end class Point3

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -