static void Main2(string[] args) { RectangleBad rc = new RectangleBad(2, 3); Console.WriteLine($"{rc} has area {Area(rc)}"); // should be able to substitute a base type for a subtype /*Square*/ RectangleBad sq = new SquareBad(); sq.Width = 4; Console.WriteLine($"{sq} has area {Area(sq)}"); }
static public int Area(RectangleBad r) => r.Width * r.Height;