Search code examples
c++classvirtualderived

Derived Class (Pure virtual C++)


I have problem using class base with pure virtual method. The method should be virtual.

I get this error:

Error: object of abstract class type "Membro" is not allowed: function "Membro::mensalidade" is a pure virtual function

enter image description here

Anyone can help?

Thanks!


Solution

  • The problem is clear from the error message: you may not instantiate an object of an abstract class.

    However it seems that there is no need to create an object of the abstract class in the function you showed. As I have understood the function searches an object with the given string bi. You could use a lambda expression in some search method.

    That is the problem is that the design of the function is incorrect. To get more exact answer you should show the function and what is the type of membros.