반응형
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);
}
}
}
-Thanks 상철 ㅋ
using System;
-Thanks 상철 ㅋ
using System;
namespace testproperty
{
{
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 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 gaa()
{
aa = 11;
return aa;
}
public int gbb()
{
return bb;
}
}
class point3
{
private int z;
{
this.aa=aa;
this.bb=bb;
}
public int gaa()
{
aa = 11;
return aa;
}
public int gbb()
{
return bb;
}
}
class point3
{
private int z;
public int Z
{
get { return z; }
set { z = value; }
}
private int zz;
{
get { return z; }
set { z = value; }
}
private int zz;
public int Zz
{
get { return zz; }
set { zz = value; }
}
}
{
get { return zz; }
set { zz = value; }
}
}
class program
{
public static void Main()
{
point1 pt1 = new point1(3, 4);
Console.WriteLine("{0},{1}", pt1.a, pt1.b);
pt1.a = 1;
pt1.b = 2;
Console.WriteLine("{0},{1}", pt1.a, pt1.b);
{
public static void Main()
{
point1 pt1 = new point1(3, 4);
Console.WriteLine("{0},{1}", pt1.a, pt1.b);
pt1.a = 1;
pt1.b = 2;
Console.WriteLine("{0},{1}", pt1.a, pt1.b);
point2 pt2 = new point2();
pt2.set(10, 20);
Console.WriteLine("{0},{1}", pt2.gaa(), pt2.gbb());
pt2.set(10, 20);
Console.WriteLine("{0},{1}", pt2.gaa(), pt2.gbb());
point3 pt3 = new point3();
pt3.Z=77;
pt3.Zz=88;
Console.WriteLine("{0},{1}",pt3.Z, pt3.Zz);
}
}
pt3.Z=77;
pt3.Zz=88;
Console.WriteLine("{0},{1}",pt3.Z, pt3.Zz);
}
}
}
'Writer > WarmingUp Code' 카테고리의 다른 글
눈물의 소스 박스형 for와 if 사용 첨부 상철 상봉 오윤 (0) | 2008.10.09 |
---|---|
소스 복습 (0) | 2008.10.08 |
객체지향 소스 (0) | 2008.10.07 |
성적출력 (0) | 2008.10.07 |
소스연습 (0) | 2008.10.06 |
string ToString() bool float object enum boxing char (0) | 2008.10.04 |
복습 (0) | 2008.10.02 |
클래스 구조체 (0) | 2008.10.01 |