Beispiel #1
0
        public double DistanceTo(Shotgun other)
        {
            int    xDiff    = this.x - other.x;
            int    yDiff    = this.y - other.y;
            double distance = Math.Sqrt((xDiff * xDiff) + (yDiff * yDiff));

            return(distance);
        }
Beispiel #2
0
        static void doWork()
        {
            Shotgun origin      = new Shotgun();
            Shotgun bottomRight = new Shotgun(1366, 768);
            double  distance    = origin.DistanceTo(bottomRight);

            Console.WriteLine($"Distance is: {distance}");
            Console.WriteLine($"Number of Point objects: {Shotgun.ObjectCount()}");
        }