I am using NetBeans IDE 6.8 to create C++ project. While I use class inheritance, however, it seems to me that it does not recognize the derived class. Here is what I have:
class A
{
public:
A(vector<double> a, double b) {...}
};
class B : public A
{
public:
additionalfunction(...) {...}
};
main()
{
vector<double> c = something;
double d = 0;
B b=B(c, d);
}
And the compiler tells me that "B(c,d)" is not declared. I tried Eclipse C++, it told me the same thing. Why is that? Is it because both IDEs do not support C++ inheritance? What should I do?
Any reply is appreciated.
Subclasses don't inherit constructors. You're trying to call B(double, double), but there is no B(double, double). You can define B(double, double), or you can use this pattern from the C++ FAQ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With