I have some questions about inheritance and function overloading. I wrote some interfaces something like below. Now I'm trying to call some function of the parent class from derived class but it doesn't work as I intended.
Why is it possible to call b.hello() but not b.test()?
#include <iostream>
using namespace std;
class A {
public:
void hello() {}
void test() {}
virtual void test(int a) {}
};
class B : public A {
public:
void test(int a) override {}
};
int main() {
B b;
// Is possible to call test(int) through B
b.test(1);
// Is not possble to call test() through B
b.test();
// But, is possible to call hello() through B
b.hello();
}
;which lets me thing that your real code is different) and the error.testfunction inB, and when it finds it there, discovers that you try to call it without parameters.