I encountered a this kind of problem while writing my code how do I work around this?
second.h is :
#pragma once
#include "first.h"
class second : public first
{
private:
int step;
public:
second(int value, int s) :first(value), step(s) {}
void increase() {
counter += step;
}
};
and first.h is :
#pragma once
class first
{
protected:
int counter;
public:
first():counter(0){}
first(int a) :counter(a) {}
virtual void increase() {
counter++;
}
second getequivalent(int step) {
return second(counter, step);
}
};
My question is, how do i get method
second getequivalent(int step) {
return second(counter, step);
}
working in class "first"?