title: Class function won't take argument passed by reference
body: <p>I am writing an interface for a program that will eventually be able to interpret another language. Right now I am trying to make it so if the user enters a phrase followed by () with text within the parentheses, then it will read it as a function and pass that phrase as a string into a function that opens files. When I isolate just that part into another testing program, it does not throw any error codes. But when I test it out in the program I need it to work in, it throws the following:</p>
  <pre><code>Severity    Code    Description Project File    Line    Suppression State
  Error   C2660   'Interface::read': function does not take 1 arguments   pysub1   
  C:\Users\Johnathon\source\repos\pysub1\pysub1\interface.cpp 50  
  Error   C2511   'void Interface::read(std::string &amp;)': overloaded member function not 
  found in
  
   'Interface'    pysub1  C:\Users\Johnathon\source\repos\pysub1\pysub1\interface.cpp 131 
  </code></pre>
  <p>And here is the code:
  //</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  #include &quot;interface.h&quot;
  using namespace std;
  
  void Interface::startInterface()
  {
  string input, command, file;
  do
  {
      std::cout &lt;&lt; &quot;PySUB Interpreter 1.0 on Windows (September 2022)&quot; &lt;&lt; endl;
      std::cout &lt;&lt; &quot;Enter program lines or read(&lt;filename&gt;.py) at command line interface&quot; 
  &lt;&lt; endl;
      std::cout &lt;&lt; &quot;Type 'help' for more information or 'quit' to exit&quot; &lt;&lt; endl;
      std::cin &gt;&gt; input;
      
      if (input.back() == ')')//this checks to see if the user input is a function. the 
  idea here is that if it is a function, there will be a right-side paren.
      {
          for (int i = 0; i &lt; input.length(); i++)
          {
              if (input[i] == '(')//checks for an opening parenthesis
              {
                  if (input[i + 1] != ')')//makes sure that there isn't a closing paren. 
  directly after opening paren.
                  {
                      for (int k = i + 1; k &lt; input.length() - 1; k++)//loop that 
  continues iterating after the opening paren. and stops just before the last character, 
  which is a closing paren.
                      {
                          command.push_back(input[k]);//pushes characters into string 
  variable to be passed into other functions. 
                      }
                  }
                  else
                  {
                      break;//this checks to see if there is a corresponding parenthesis. 
  if there is not, the loop will break.
                  }
              }
          }
          for (int j = 0; j &lt; command.length(); j++)
          {
  filetype will include a '.'
              {
                  break;
              }
              else
              {
                  file = command;//if command is a filetype, file is now command and file 
  will be passed to the read function.
              }
          }//if command is a filetype, verify that the first 4 characters of input is 
  equal to read
          if (!file.empty())//if file string is not empty, pass the file value into the 
  read function
          {
              read(file);
              cin &gt;&gt; input;
  
          }
      }
  
  
      if (input == &quot;help&quot;)
      {
          help();
      }
      else if (input == &quot;show&quot;)
      {
          show();
      }
  
  
  
  
  
  } while (input != &quot;quit&quot;);
  }
  
  
  void Interface::help()
  {
  {
      string input;
      std::cout &lt;&lt; &quot;&gt;&gt;&gt; Help&quot; &lt;&lt; endl;
      std::cout &lt;&lt; &quot;Welcome to the help utility!&quot; &lt;&lt; endl;
      std::cout &lt;&lt; &quot;* To exit and return to the interpreter, type 'exit&quot; &lt;&lt; endl;
      std::cout &lt;&lt; &quot;* To get a list of commands, type 'commands'&quot; &lt;&lt; endl;
      std::cout &lt;&lt; &quot;* To get a description of any command, just type the command at the 
  help&gt; prompt&quot; &lt;&lt; endl;
      do
      {
          std::cout &lt;&lt; &quot;help&gt;&quot;;
          std::cin &gt;&gt; input;
          if (input == &quot;commands&quot;)
          {
              std::cout &lt;&lt; &quot;Below is a list of commands. Enter any command at the promp 
  to get more help&quot; &lt;&lt; endl;
              std::cout &lt;&lt; &quot;       &quot; &lt;&lt; endl;
              std::cout &lt;&lt; &quot;clear    help    quit&quot; &lt;&lt; endl;
              std::cout &lt;&lt; &quot;read     show&quot; &lt;&lt; endl;
              std::cout &lt;&lt; &quot;       &quot; &lt;&lt; endl;
              std::cout &lt;&lt; &quot;NOTE: All commands can also be entered as functions:&quot; &lt;&lt; 
  endl;
              std::cout &lt;&lt; &quot;       &quot; &lt;&lt; endl;
              std::cout &lt;&lt; &quot;       &quot; &lt;&lt; endl;
              std::cout &lt;&lt; &quot;clear()    help()    quit()&quot; &lt;&lt; endl;
              std::cout &lt;&lt; &quot;read()     show()&quot; &lt;&lt; endl;
  
          }
          else if (input == &quot;clear&quot; || input == &quot;clear()&quot;)
          {
              std::cout &lt;&lt; &quot;This command clears out or deletes any lines that are stored 
  in the program data structure.&quot; &lt;&lt; endl;
          }
          else if (input == &quot;help&quot; || input == &quot;help()&quot;)
          {
              std::cout &lt;&lt; &quot;This command will enter the help utility.&quot; &lt;&lt; endl;
          }
          else if (input == &quot;quit&quot; || input == &quot;quit()&quot;)
          {
              std::cout &lt;&lt; &quot;This command exits the command line interpreter.&quot; &lt;&lt; endl;
          }
          else if (input == &quot;read&quot; || input == &quot;read()&quot;)
          {
              std::cout &lt;&lt; &quot;This command reads a file to be interpreted.&quot; &lt;&lt; endl;
          }
          else if (input == &quot;show&quot;)
          {
              std::cout &lt;&lt; &quot;This command shows the results from a file that was read. 
  This must be used in conjunction with the 'read' command.&quot; &lt;&lt; endl;
          }
      } while (input != &quot;exit&quot;);
  }
  }
  
  void Interface::show()
  {
  
  }
  
  void Interface::read(string&amp; var)
  {
  ifstream ofile;
  string line;
  ofile.open(file);
  cout &lt;&lt; &quot;Reading data from the file.\n&quot;;
  if (ofile.is_open())
  {
      while (getline(ofile, line))
      {
          printf(&quot;%s&quot;, line.c_str());
      }
      ofile.close();
  }
  }
  
  void Interface::clear()
  {
  
  }
  
  int main()
  {
  Interface pySubInterpreter;
  
  // Start the interface
  pySubInterpreter.startInterface();
  
  return 0;
  }
  </code></pre>
  <p>And the following is the header file</p>
  <pre><code>#ifndef INTERFACE_H
  #define INTERFACE_H 
  
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;string&gt; 
  #include &lt;fstream&gt;
  
  
  
  class Interface
  {
  private:
      typedef std::vector&lt;std::string&gt; programType;
      programType programCode;
      
  
  public:
      void startInterface();
  
      void quit();
  
      void help();
  
      void show();
  
      void read(string&amp; var);
  
      void clear();
  
  };
  
  #endif 
  </code></pre>