title: '!' : illegal operation on bound member function expression
body: <p>this is my code for my coursework. i keep getting the same error.</p>
  
  <p>'!' : illegal operation on bound member function </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;fstream&gt;
  
  
  #include "AMcore.h"
  using namespace std;
  
  
  int main (){
  
  
  std::string filename1, filename2;
  
  int plotPoint;
  
  cout &lt;&lt; "Amplitude Modulation Coursework" &lt;&lt; endl;
  cout &lt;&lt; "Name: Mohammad Faizan Shah" &lt;&lt; endl;
  cout &lt;&lt; "Student ID: 5526734 \n\n\n" &lt;&lt; endl;
  
  //AMcore obj1;
  
  std::ifstream carrier(filename1);
  cout &lt;&lt; "Please enter the filename of the Carrier wave \n" &lt;&lt; endl;
  do{
      cin &gt;&gt; filename1;
  
  
      if (carrier.is_open)
      {
          cout &lt;&lt; "file read succesfully... \n" &lt;&lt; endl;
      }
      else if (!carrier.is_open)
      {
          cout &lt;&lt; "file is not found!... Try carrier.txt...\n" &lt;&lt; endl;
  
      }
  } while (!carrier.is_open);
  </code></pre>
  
  <p>This is my AMcore file:
      //Function Definition
      #include 
      #include "AMcore.h"</p>
  
  <pre><code>AMcore::AMcore() {
  
  std::string carrier  ;
  std::string information ;
  
  }            
  AMcore::AMcore(string filename1, string filename2){
  filename1 = carrier;
  filename2 = information;
  
  }
  
  AMcore::~AMcore(){
  
  }
  
  string AMcore::getcarrier() const{
  return carrier;
  
  
  }
  </code></pre>
  
  <p>And finally my AMcore.h (header file)</p>
  
  <pre><code>   // Header -&gt; Function Decleration
  
     #include &lt;iostream&gt;
     #include &lt;string&gt;
  
     using namespace std;
  
     #ifndef AMcore_h
     #define AMcore_h
  
      class AMcore{
  
      public:
      //defualt constructor
      string carrier;
      string information;
      AMcore();
  
      //overload constructor
      AMcore(string,string); 
  
      //destructor
      ~AMcore();
  
      //Accessor Functions
      string getcarrier() const;
      // returns name of txt file
  
      string getinformation() const;
      //returns name of txt file
  </code></pre>