파일 목록
-
📁 10
-
📁 3
-
📁 4
-
📁 4-minicalc
-
📁 7
-
📁 parking manager
- 2.cs
- desktop.ini
- Title.png
- 객체지향 3대 특징(+1).txt
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace Week9ClassA
{
internal class Point //생성자로 만들면서 초기화하거나 메소드 이용
{
private int x;
private int y;
/// <summary>
/// 생성자: 인스턴스 생성시 초기화
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
public Point(int x, int y)
{
this.x = x;
this.y = y;
}
public void setX(int x)
{
this.x = x;
}
public void setY(int y)
{
this.y = y;
}
public int GetX()
{
return this.x;
}
public int GetY()
{
return this.y;
}
public void AddX(int offset)
{
this.x += offset;
}
public void AddY(int offset)
{
this.y += offset;
}
public void AddXY(int xOffset, int yOffset)
{
this.x += xOffset;
this.y += yOffset;
}
public void AddXY(Point pOffset)
{
this.x += pOffset.GetX();
this.y += pOffset.GetY();
}
}
}