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