반응형
using System;
using System.Collections.Generic;
using System.Text;
namespace pt1
{
class Point1
{
public int a;
public int b;
public Point1(int a,int b)
{
this.a = a;
this.b = b;
}
}
class Point2
{
private int aa;
private int bb;
public void set(int aa,int bb)
{
this.aa = aa;
this.bb = bb;
}
public int getaa()
{
return aa;
}
public int getbb()
{
return bb;
}
}
class Point3
{
private int xx;
private int yy;
public int Xx
{
get { return xx; }
set { xx = value; }
}
public int Yy
{
get { return yy; }
set { yy = value; }
}
}
class Program
{
static void Main(string[] args)
{
Point1 pt1 = new Point1(1,2);
Console.WriteLine("x={0} y={1}",pt1.a,pt1.b);
//Console.ReadKey();
Point2 pt2 = new Point2();
pt2.set(10, 20);
Console.WriteLine("{0},{1}", pt2.getaa() , pt2.getbb());
Point3 pt3 = new Point3();
pt3.Xx=50;
pt3.Yy=60;
Console.WriteLine("{0},{1}",pt3.Xx,pt3.Yy);
}
}
}