Function Overloading different accessability but also different parameter

  access-modifiers, c++, interface, overloading

Why is this not possible?

class DBHelper {
    bool open(const char* filepath, const char* query = "");

    bool open(const char* filepath);

If I want to access the function open(filepath) of my library from another class it won’t compile, eventhough the compiler should take the public function with the default argument. I don’t want the user of the library to have access to the private function. Of course, the user could simply call open(filepath, ""). However, this is not comfortable and doesn’t make sense, since I specified a default value.

This post states that both functions are visible. However, since access is denied, there should be only one choice for the compiler.

I thought it is a common style to have an interface function with default parameters and private functions which are implemented based on the input.

(The interface function should create the default layout of the database if a ‘create query’ is given, otherwise it should just try to open an already existing database)

Source: Windows Questions C++