If I have a derived class that has both const and non-const getters for its data, how do I make them private / protected separately in the derived class?
I tried to "disable" the non-const one and the compiler complains even though it doesn't need the non-const one.
Edit: to be clear, I don't want to disable both "getInt()" functions, only the non-const one. (or the const one, but only one of them)
class Base{
public:
int i;
void foo() const;
void foo();
const int& getInt() const;
int& getInt();
};
class Derived : public Base{
protected:
void foo();
int& getInt();
public:
};
Derived d;
int i = d.getInt(); //error, getInt() is protected