Constructor in class cannot be applied to given types

后端 未结 3 1071
别那么骄傲
别那么骄傲 2020-12-02 01:01

I ve got the following code using arrays to find some prim numbers. However, when trying to compile my user class PalindromeArrayUser it says - \"Constructor in class cannot

3条回答
  •  长情又很酷
    2020-12-02 01:21

    Error is because you are extending PalindromeArray, which has an explicit constructor. You must provide the constructor with argument.

    Because there is no default constructor available in B, as the compiler error message indicates. Once you define a constructor in a class, the default constructor is not included. If you define any constructor, then you must define all constructors.

    Read more here

    Disclaimer: The above is taken from the article

提交回复
热议问题