Hello,
can anyone tell me why cannot declare pointer A?
sheader.h
simple.cc
Thanks
can anyone tell me why cannot declare pointer A?
sheader.h
Code:
#ifndef __SHEADER_H__
#define __SHEADER_H__
#include <iostream>
using namespace std;
class B{
A *connA;
public:
void makeconn (A *ptrA){
connA=ptrA;
}
void just (void){
cout << "HELLO FROM B" << endl;
connA->just();
}
};
#endif
simple.cc
Code:
#include <iostream>
#include "sheader.h"
using namespace std;
class A{
B *connB;
public:
void makeconn (class B *ptrB){
connB=ptrB;
}
void just (void){
cout << "HELLO FROM A" << endl;
connB->just();
}
};
int main(int argc, char *argv[]){
A *simpleA;
B *simpleB;
int i;
cout << "PROGRAM BEGINED" << endl;
simpleA->just();
simpleB->just();
cin >> i;
return 0;
}
Thanks