C#第四章3.(1)

来源:互联网 发布:淘宝没有货到付款 编辑:程序博客网 时间:2024/05/12 16:29

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class MyClass
{

 public static void Main()

 {

  CPoint cp=new CPoint();

  cp.Display();

  cp.setpointQ(80,150);

  cp.Display();

  Console.ReadLine();

 }

}

public class CPoint

{

 private int x=60;

 

 private int y=75;


 public CPoint()
 {

 }
 

 public CPoint(int x,int y)

 {

  this.x=x;

  this.y=y;

 }

 

 public void Display()

 {

  Console.WriteLine("x={0},y={1}",x,y);

 }

 

 public void setpointQ(int x, int y)

 {

  this.x=x;

  this.y=y;

 }

}

 

0 0