D
Dragilla
Hi, I have a problem....
I can show you what this is about in an example:
There are 4 files:
a.c:
#include "a.h"
int main() {
B* b = new B();
A* a = new A();
a->bref = b;
b->aref = a;
b->aref->test();
a->bref->test();
return 0;
}
b.c:
#include "b.h"
a.h:
#ifndef A_H
#define A_H
#include "b.h"
#include <stdio.h>
#include <stdlib.h>
class B;
class A {
public: B* bref;
public: A() {;}
public: void test()
{
printf ("test in A\n");
bref->test();
}
};
#endif
b.h:
#ifndef B_H
#define B_H
#include "a.h"
#include <stdlib.h>
#include <stdio.h>
class A;
class B {
public: A* aref;
public: B() {;}
public: void test() { printf ("test in B\n"); }
};
#endif
Why does this not compile? I get errors in line with code: bref-
regards,
I can show you what this is about in an example:
There are 4 files:
a.c:
#include "a.h"
int main() {
B* b = new B();
A* a = new A();
a->bref = b;
b->aref = a;
b->aref->test();
a->bref->test();
return 0;
}
b.c:
#include "b.h"
a.h:
#ifndef A_H
#define A_H
#include "b.h"
#include <stdio.h>
#include <stdlib.h>
class B;
class A {
public: B* bref;
public: A() {;}
public: void test()
{
printf ("test in A\n");
bref->test();
}
};
#endif
b.h:
#ifndef B_H
#define B_H
#include "a.h"
#include <stdlib.h>
#include <stdio.h>
class A;
class B {
public: A* aref;
public: B() {;}
public: void test() { printf ("test in B\n"); }
};
#endif
Why does this not compile? I get errors in line with code: bref-
PLEASE help.test(); in a.h
regards,