this code in c++
#include <iostream>
using namespace std;
int main()
{ return 0; }
struct X;
struct Y;
struct Y
{ X ox; };
struct X
{ Y oy; };
gives error as:"field `ox' has incomplete type"
how to resolve it without using pointer
this code in c++
#include <iostream>
using namespace std;
int main()
{ return 0; }
struct X;
struct Y;
struct Y
{ X ox; };
struct X
{ Y oy; };
gives error as:"field `ox' has incomplete type"
how to resolve it without using pointer
Using a pointer member is probably the correct approach. If not, you might use a reference member.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Use code tags, first of all... Other than that, the problem can't be resolved without pointers. See, if "A" contains "B" but "B" contains "A"... That's kind of impossible unless A == B.
yes reference will definitely work ,
but I don’t understand code tag ,EVOEx,will u please elaborate this.
Before code, add the text "[ code ]" (without spaces). After the code at "[ /code ]" (without spaces). If you do that code should be indented. See the difference:
#include <iostream>
int main()
{
for(int i = 0; i < 100; ++i)
std::cout << i << std::endl;
}
(No code tags)
(with code tags)Code:#include <iostream> int main() { for(int i = 0; i < 100; ++i) std::cout << i << std::endl; }