I have the following code:
template <class T>
class Planet{
protected:
std::map<ID, std::shared_ptr<T>> population;
ID freeId;
public:
//@todo dorobić name
Planet();
T& registerCitizen(std::string);
T& findCitizen(ID);
T& findCitizen(std::string);
};
template <class T>
class PairPlanet: public Planet<T>{
public:
T& registerCitizen(T&, T&);
};
The problem here is that PairPlanet seems not to inherit from planet: For example if I try to define: template
T& PairPlanet<T>::registerCitizen(T& per1, T& per2){
T* new_person = new T(per1.citizenName+"&"+per2.citizenName,freeId);
population.insert(std::pair<ID, T>(freeId, *new_person)).first;
freeId++;
return *new_person;
};
I receive an information that both population and freeId are undefined. May I ask for some hints?