I am working on an OPP code and I want to write a get function for a vector.
I have a vector and each element of the vector is a class and there is a vector in that class and I want to get access to that class:
1 2 3 4 5 6 7 8 9 10 11 12 13
class TemperatureRepo{
private:
vector<Cell*> cls; // pointer vector for the whole study area
};
class Cell{
private:
std::vector<double> AirT;
public:
std::vector<double> getAirT() { return AirT; }
};
considering mentioned situation, I want to get access the AirT vector in the following class. I was wondering if it is possible? Otherwise, what is the best alternative?
1 2 3 4 5 6 7 8 9
class Temperature {
TemperatureRepo* Repo;
Cell* cls;
std::vector<double> tempAitT = Repo->cls[15]->getAirT();
};