E
Eric
I am writing a program with several header files. I would like for some
of them to be aware of others. Here is a small example of my problem in
three different files:
//// main.c++
#include "A.h"
#include "B.h"
int main () {
using namespace std;
return 0;}
//// A.h
#ifndef A_h
#define A_h
class A{
public:
void call_b(B b){
b.dummy();}
void dummy(){
int i = 0;}}
#endif // A_h
////B.h
#ifndef B_h
#define B_h
class B{
public:
void call_a(A a){
a.dummy();}
void dummy(){
int i = 0;}}
#endif // B_h
<END>
This does not compile. Can anyone tell me why, and how to let A and B be
aware of each other?
of them to be aware of others. Here is a small example of my problem in
three different files:
//// main.c++
#include "A.h"
#include "B.h"
int main () {
using namespace std;
return 0;}
//// A.h
#ifndef A_h
#define A_h
class A{
public:
void call_b(B b){
b.dummy();}
void dummy(){
int i = 0;}}
#endif // A_h
////B.h
#ifndef B_h
#define B_h
class B{
public:
void call_a(A a){
a.dummy();}
void dummy(){
int i = 0;}}
#endif // B_h
<END>
This does not compile. Can anyone tell me why, and how to let A and B be
aware of each other?