using System;using System
using System;using System.Collections.Generic;using System.Linq;using
System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Point origin = new Point();
Point bottomRight = new Point(1366, 768);
double distance = origin.DistanceTo(bottomRight);
Console.WriteLine($”Distance is: {distance}”);
Console.WriteLine($”Number of Point objects: {Point.ObjectCount()}”);
}
}
class Point
{
private int x, y;
private int objectCount = 0;
public Point()
{
this.x = -1;
this.y = -1;
objectCount++;
}
public Point(int x, int y)
{
this.x = x;
this.y = y;
objectCount++;
}
public double DistanceTo(Point other)
{
int xDiff = this.x – other.x;
int yDiff = this.y – other.y;
double distance = Math.Sqrt((xDiff * xDiff) + (yDiff * yDiff));
return distance;
}
public static int ObjectCount()
{
return objectCount;
}
}
}
I am getting this error
Severity Code Description Project File Line Suppression State
Error CS0120 An object reference is required for the non-static field, method, or property ‘Point.objectCount’ ConsoleApplication2 C:UsersTrey PerrymanDocumentsConsoleApplication2ConsoleApplication2Program.cs 46 Active