Example: Making a Matrix Name

A good example of making a matrix name is found in the routine for inverting a matrix. The section of code is

     strtype newname = "invs(";
     newname = newname + ROp.Getname(ROp) + ")";
     .
     .
     .
     temp->Nameit( newname );

The idea is to construct the inverse of the matrix object ROp. The name of the matrix object is private, so it must be accessed through the member function Getname(). The name of the inverse should be invs(rop) supposing the name of ROp is rop. A new string is created using the constant string "invs(", then 'rop' is extracted from the matrix, and a parenthesis is appended. A temporary matrix pointer was created during the matrix inversion. The matrix member function Nameit() stores the string in the matrix name. So, two member functions of the matrix class are used for manipulating the name of the matrix.