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 is a discussion on How to resolve this error in c++? within the C++ Programming forums, part of the General Programming Boards category; this code in c++ #include <iostream> using namespace std; int main() { return 0; } struct X; struct Y; struct ...
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.
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
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; }