With c++, I am trying to create a class called "family". Family is parent class of child class "man," and I'm trying to create an array of "man" in family class, but in order to do that, I need to include man.hpp in family.hpp. But this messes things up really bad... as now man doesn't acknowledge family as a base class.
So my question is this: How can I Include an array of child class in a parent class?
Thanks in advance!
#ifndef Family_hpp
#define Family_hpp
//here I want to include "include "man.hpp"" but this messes up."
class Family {
public:
//functions and constructor
private:
Man** manarray;
};
and here's family_cpp
#include "Family.hpp"
#include "Man.hpp"
#include<iostream>
#include<string>
using namespace std;
Family::Family() {
}
void Family::setMen(int n) {
for (int i = 0; i < n; i++) {
*(manarray+ i + 1) = new man();
}