compilation error with g++ compiler version 3.4.3

in following code I am getting compilation error.

Code is below:

#include <stdio.h>

#include <stdlib.h>

#include <strings.h>

class TEST;

class ONE

{

friend class TEST;

void fun(const TEST& value)

{

value.a;

}

};

class TEST

{

protected:

int a;

};

int main()

{

return 0;

}

__

Errors is:

g++ -g test.C -o test

test.C: In member function `ONE& ONE::operator=(const TEST&)':

test.C:12: error: invalid use of undefined type `const struct TEST'

test.C:5: error: forward declaration of `const struct TEST'

What could be problem?

Message was edited by:

neerajrathi2

[789 byte] By [neerajrathi2a] at [2007-11-26 14:25:14]
# 1
The problem is what the error message is trying to tell you.The code does not define class TEST, but you are trying to use a member of class TEST in the body of function ONE::fun.You cannot mention a member or base class of a class until the full class definition has been
clamage45a at 2007-7-8 2:18:08 > top of Java-index,Development Tools,Solaris and Linux Development Tools...