Declaration problem

Joined
Jun 5, 2007
Messages
2
Reaction score
0
Hello,

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,073
Messages
2,570,539
Members
47,197
Latest member
NDTShavonn

Latest Threads

Top