I am a learning c++ and this is an assignement, I'm trying to figure out why I get this error when I try to run the code
"... was not declared in this scope"
Please tell me how can I make the derived class see the variables in the main class
This is a header file.
template <typename A>
class aligner{
public:
A filler;
size_t max_size;
std::vector<std::vector<A>*> vector;
void add(std::vector<A> &v){
vector.push_back(&v);
if(v.size() > max_size){
max_size = v.size();
}
}
int count(){
return vector.size();
}
void set_filler(A f){
filler = f;
}
virtual void align() = 0;
aligner(): filler(), max_size(0) {}
~aligner();
};
template <typename A>
class center_aligner: public aligner<A>{
public:
void align(){
for(std::vector<A> vec : vector){
if(vec->size() < max_size){
for(int i = 0; i < (max_size - vec->size); i++){
if(i%2==0){
vec.push_back(filler);
}else{
vec.insert(vec.begin(),filler);
}
}
}
}
}
center_aligner();
~center_aligner();
};