[gnu.g++] friend function and derived class

saito@sdrvx1.sinet.slb.com (Naoki Saito (GEO-002) Ext. 5471) (07/22/89)

	Let me explain with the actual example.  Suppose we have a Complex
class as in the libg++.  I want to create a Complex matrix class whose element
consists of Complex.  Then I want to define conjugate function of the Complex
matrix class as well as the Complex class:

In Complex.h,

friend Complex conj(Complex& z);

In ComplexMatrix.h,

friend ComplexMatrix conj(ComplexMatrix& Z);

I want to use the conj function of the Complex class in the definition of the
ComplexMatrix's conj as follows:

for (i = 0; i < rows; i++)
  for (j = 0; j < cols; j++)
       ZC.buf[i][j] = conj(ZC.buf[i][j]);

However, this does not work.  If I use Complex::conj(ZC.buf[i][j]), this
doesn't work either because conj is not a member function of Complex class!!
So the only way I found so far is to give a different name such as "Conj" for
ComplexMatrix class.  (I appreciate that UNIX system discriminate upper and
lower letters!!)   Is there really no way to use the same name "conj" in the
above context?

Thanks in advance,
Naoki Saito (saito@sdr.slb.com)
Schlumberger-Doll Research