gjditchfield@violet.UUCP (10/19/87)
A copy of the error message is included in the comments after class b.
Note that the errors are produced by the C compiler, not C++. The error
messages disappear if val is moved out of the class, or if one of the calls
to val is removed from main's print statement.
--------------------------------------
#include <stream.h>
class b {
friend int val(b& bv, int iv) { // line 3
int t = bv.i;
bv.i = iv;
return t;
};
int i;
};
//ccc ft.cc:
//cc ft..c /usr/lib/libccc.a
//"ft.cc", line 3: redeclaration of "_au2__Xt_val_global"
main() {
b bozo;
int temp = val(bozo, 3);
cout << val(bozo, 4) << val(bozo, 5);
}
--
Glen Ditchfield {watmath,utzoo,ihnp4}!watrose!gjditchfield
Dept of Computer Science, U of Waterloo (519) 885-1211 x6658
Waterloo, Ontario, Canada Office: MC 2006
If you grab the bull by the horns, you at least confuse him -- R.A.Heinlein