next up previous contents
Next: Tests Up: Bank Numbers Previous: Bank Numbers

Initialization

Typically one initializes an instance of TRY_Bank_Number with an integer, such as

TRY_Bank_Number my_bank_number(5) ;

In many cases, however, one will simply pass the bank number as an argument to a function without bothering to store it explicitly in a named variable, such as

a_method( TRY_Bank_Number(5) , ...) ;

In fact, if a_method() does not take a C-string for the first argument, then one can take advantage of an implicit conversion of integers to TRY_Bank_Numbers to shorten this line of code further by writing simply:

a_method( 5 , ...) ;

One must use the default constructor in some cases, such as when declaring a built-in array of bank numbers. Then the assign() method can be used to set the otherwise invalid bank number object to a valid number, such as

TRY_Bank_Number my_bank_number ; // Default constructor puts it in invalid state
my_bank_number.assign(5) ;       // Now valid



Robert Kennedy
Mon Jul 28 13:23:28 CDT 1997