The general tests of validity and equality are provided. For example,
TRY_Bank_Number no_number ; // default constructor puts it into invalid state
if (no_number.is_invalid())
{ // yes, no_number is invalid
}
TRY_Bank_Number LRID_number(1) ;
TRY_Bank_Number CMUO_number(5) ;
if (LRID_number != CMUO_number)
{ // Of course, they are not equal
}
TRY_Bank_Number LRID_number(TRY_Bank_Number::wildcard) ;
TRY_Bank_Number CMUO_number(5) ;
if (LRID_number == CMUO_number)
{ // Due to wildcard, they are equal
}
TRY_Bank_Number LRID_number(TRY_Bank_Number::nullcard) ;
TRY_Bank_Number CMUO_number(5) ;
if (LRID_number != CMUO_number)
{ // Due to nullcard, they are not equal unless both are nullcard
}
There are also tests for exactness (value is not a wildcard or special value) is_exact() and is_inexact() in TRY_Bank_Number. A bank number is exact only if it has a non-negative value, otherwise it is inexact and represents one of the special values.
One can access the bank number as an integer or as a string using
cout << my_bank_number.as_string() ; // prints a string representing value cout << my_bank_number.as_integer() ; // print the integer value itself
The special bank number values are translated into words if accessed as a string, but are left as their integer values if accessed as an integer.