i have created two classes A and B so i have 5 files , main.cpp , A.h , A.cpp , B.h , B.cpp
i have included all headers as it should be and im trying to create a object of class A in class B and i get the following error : error: A doesn't name a type
and if i to it repeated like i define object B in class A it works ,,, whats wrong?
this is how my B.h looks like >
#ifndef B_H
#define B_H
#include <iostream>
#include "A.h"
using namespace std;
class B
{
public:
B();
protected:
private:
A instance;
};
#endif // B_H
and now A.h
#ifndef A_H
#define A_H
#include <iostream>
#include "B.h"
using namespace std;
class A
{
public:
A();
protected:
private:
};
#endif // A_H