using System.Collections.Generic;
using System.Text.RegularExpressions;
private class PaymentInstrument
public string AccountNumberLastFourDigits { get => (AccountNumber.Length < 4) ? AccountNumber : AccountNumber[^4..]; }
public string AccountNumber { get; set; }
private class CheckInstrument : PaymentInstrument
public override string ToString()
"AccountNumber = {0}, AccountNumberLastFourDigits = {1}",
AccountNumber, AccountNumberLastFourDigits
public static void Main()
var check = new CheckInstrument
AccountNumber = "987654321"
Console.Write(check.ToString());