2
이 질문을 잘 설명하는 방법을 잘 모르겠습니다. 이해하기 어려운 경우 사과드립니다.클래스의 객체에 의해 호출 될 필요가없는 클래스에서 메소드 만들기
그냥 연습 (저는 C#에서 아직 완전히 익숙하지 않습니다)으로, 좌표 격자에서 점처럼 작용하는 클래스 인 Point를 만들고 싶었습니다. 지금까지이 있습니다
using System;
using System.Collections.Generic;
using System.Text;
namespace Point_Class
{
class Point
{
private int x, y;
public Point()
{
Console.WriteLine("Default Constructor Loaded.");
this.x = 0;
this.y = 0;
}
public Point(int x, int y)
{
this.x = x;
this.y = y;
}
public string Equation(Point p1, Point p2)
{
}
}
class Program
{
static void Main(string[] args)
{
Point x,y;
x = new Point(2, 2);
y = new Point(5, 6);
x.DistanceTo(y);
Console.ReadLine();
}
}
}
지금, 내 질문은 이것이다 : 수학 식을 실행하는 방법 (함수 나 방법, 용어의 확신)이
Equation(Point x, Point y);
등이 아니면이 있는가 다른 것인가? 감사합니다. .
(http://en.wikipedia.org/wiki/로 호출 할 수 있습니다 Factory_method_pattern). –