I have a class A
implemented by files A.hpp and and A.cpp.
One of the methods of class A
receives a message, translates it and stores it into a structure.
The method signature looks something like this and the method is public:
eRetCode A::ParseInfo(sometype* pMessage, tParsedInfoFromA& ParsedInfo);
In my opinion tParsedInfoFromA
type should be defined (using typedef
) at A.hpp since it is relevant to class and meaningless without the class.
The simplest way is to define it above the class.
However, I feel that file A.hpp should begin with declaration of class A.
So I would like the typedef
of the structure to appear after class declaration.
Does C++ provide me with legitimate way (not some "ugly" trick) to indicate that tParsedDataFromA
is defined below so I can use a reference to structure of type tParsedInfoFromA
at declaration of ParseInfo
method?
I tried forward declaration but the compiler won't have it.
Would appreciate your comments