Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!dptg!ulysses!andante!alice!shopiro From: shopiro@alice.UUCP (Jonathan Shopiro) Newsgroups: comp.lang.c++ Subject: Re: friend function and derived class Summary: You should be able to use one version of an overloaded function in the body of another. Message-ID: <9673@alice.UUCP> Date: 23 Jul 89 20:25:34 GMT References: <8907212152.AA13001@slcs.SLCS.SLB.COM> Organization: AT&T Bell Laboratories, Murray Hill NJ Lines: 28 In article <8907212152.AA13001@slcs.SLCS.SLB.COM>, saito@sdrvx1.sinet.slb.COM (Naoki Saito (GEO-002) Ext. 5471) writes: - - 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. This should work and it does work in C++ 2.0. Complain to your compiler vendor. -- Jonathan Shopiro AT&T Bell Laboratories, Warren, NJ 07060-0908 research!shopiro (201) 580-4229