I have a class named logs_i with a virtual fucntion which named begin_record; I had to write a new class named counter_logs_t which supposed to has a method which counts the logs.
Here is the interface and the implemantation of counter_logs_t:
class counter_logs_t : public log_i
{
public:
counter_logs_t(int counter);
void print_counter(void);
void add_counter(void);
virtual void begin_record(void);
private:
int counter;
};
counter_logs_t::counter_logs_t(int counter) : log_i()
{
counter = 0;
}
void counter_logs_t::add_counter(void)
{
counter++;
}
void logs_t::begin_record(void)
{
log_i::begin_record();
add_counter();
}
void counter_logs_t::print_counter(void){
cout<< counter<< endl;
}
int main()
{
counter_logs_t container1();
//some code
container1.print_counter();
return 0;
}
When I try to build I got the following error: error: 'add_counter' was not declared in the scope