Incompatible const type qualifiers in C++

  • 2020-04-02 03:09:01
  • OfStack

An error occurred while writing the program today   "Object contains type qualifiers that are incompatible with member functions." I looked it up on the web for this reason

Void showPair ();

to Void showPair () const;

In a function with something like the one shown above, if other functions are called, the other functions must have a const attribute as well, or you'll get an error with incompatible type qualifiers!

The above is all the content of this article, I hope you can enjoy it.


Related articles: