public class Building : ILandObject { public string Name { get; set; } public double Latitude { get; set; } public double Longitude { get; set; } // constructor public Building(string name, double latitude, double longitude) { Name = name; Latitude = latitude; Longitude = longitude; } public void ShowCoordinates() { Console.WriteLine("Latitude: " + Latitude); Console.WriteLine("Longitude:" + Longitude); } }
public class Park : ILandObject { public string Name { get; set; } public double Latitude { get; set; } public double Longitude { get; set; } // constructor public Park(string name, double latitude, double longitude) { Name = name; Latitude = latitude; Longitude = longitude; } public void ShowName() { Console.WriteLine("Name: " + Name); } }In this example, the Park class also implements the ILandObject interface to represent a park on Earth. The class has properties for the name of the park and its latitude and longitude coordinates, and a method to display the name of the park. The package library for ILandObject interface is the standard C# class library. It is included in the .NET Framework and is available for use in any C# project.