この質問をうまく説明する方法がよくわからないので、これが理解しにくい場合はお詫び申し上げます。
練習として (私はまだ 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);
それとも違う必要がありますか?ありがとう。