If I am declaring several variables in the base class, they will be defined in every derived class, right? I just want to have the variables in the base class once for all derived class. Example:
class Base{
public:
virtual ~Base();
protected:
Base();
int fileIndex;
};
class DerivedA : public Base{
public:
DerivedA();
virtual ~DerivedA();
void DoSth(); //using fileIndex
};
class DerivedB : public Base{
public:
DerivedB();
virtual ~DerivedB();
void DoSthDifferent(); //using the same fileIndex
};
How can I do that?