Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Doesn't C++ IDE Netbeans or Eclipse support class inheritance?

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.

like image 298
Ellen Avatar asked Feb 04 '26 18:02

Ellen


1 Answers

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.

like image 130
Dave Avatar answered Feb 07 '26 08:02

Dave



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!