Oplossing opgave 4
class GPSLocation
{
static Random rng = new Random();
public GPSLocation(): this(rng.Next(1,10), rng.Next(1,10))
{
}
public GPSLocation(int lat, int lon)
{
Latitude = lat;
Longitude = lon;
}
public int Latitude { get; set; }
public int Longitude { get; set; }
public override string ToString()
{
return $"Latitude:{Latitude}, Longitude:{Longitude}";
}
}class AdvancedGPSLocation: GPSLocation
{
public AdvancedGPSLocation():base()
{
Height = 1;
}
public AdvancedGPSLocation(int lat, int lon, int h): base(lat, lon)
{
Height = h;
}
public int Height { get; set; }
public override string ToString()
{
return $"{base.ToString()}, Height:{Height}";
}
}Last updated
Was this helpful?