title: C++ error in sort function
body: <p>I'm making a student record system for an assignment. When trying to run the program I get the error: </p>
  
  <blockquote>
    <p>"error: conversion from '' to non-scalar type 'std::stringstream' requested" </p>
  </blockquote>
  
  <p>It's coming from the <code>stringstream key = student[j].getLastName</code> line. Not sure what is wrong. </p>
  
  <pre><code>#include &lt;sstream&gt;
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include "Date.h"
  #include "Address.h"
  #include "student.h"
  
  
  using namespace std;
  
  int main(){
  
      string line;
      ifstream inputFile("studentdata.txt");
      bool keepGoing = true;
      Student *student = new Student[50];
      int i = 0;
      while(!inputFile.eof()){
          getline(inputFile, line);
          student[i].setInfo(line);
          i++;
      }
      int choice;
      cout &lt;&lt; "A Heap of Students";
      while(keepGoing){ //This while loop creates the menu and asks for user input
          cout &lt;&lt; "What would you like to do?" &lt;&lt; endl;
          cout &lt;&lt; "1. Print full report." &lt;&lt; endl;
          cout &lt;&lt; "2. Print simple report." &lt;&lt; endl;
          cout &lt;&lt; "3. Sort records." &lt;&lt; endl;
          cout &lt;&lt; "4. Quit" &lt;&lt; endl;
          cin &gt;&gt; choice;
  
          //prints full student report
          if(choice == 1){
              for(int i = 0; i &lt; 50; i++){ //Full print loop
                  cout &lt;&lt; student[i] &lt;&lt; endl;
              }
              cout &lt;&lt; endl;
              keepGoing = true;
          }
          //Just first and last name
          else if(choice == 2){
              cout &lt;&lt; "First Last" &lt;&lt; endl;
              for(int i = 0; i &lt; 50; i++){ //Simple print loop
              cout &lt;&lt; student[i].getFirstName() &lt;&lt; " " &lt;&lt; student[i].getLastName() &lt;&lt; endl;
              }
              cout &lt;&lt; endl; //formatting
              keepGoing = true;
          }
          //sort function
          else if(choice == 3){
              for(int j = 1; j &lt; 50; j++){
                  stringstream key = student[j].getLastName;
                  int i = j - 1;
                  while(i &gt; 0 &amp;&amp; student[i].getLastName &gt; key){
                      student[i+1] = student[i];
                      i = i - 1;
                  }
                  Student[i + 1] = key;
              }
  
              for j = 1 to A.length
              key = A[j]
              i = j - 1
              while i &gt; 0 and A[i] &gt; key
              A[i + 1] = A[i]
              i = i - 1
              A[i + 1] = key
  
              keepGoing = true;
          }
          //quit
          else if(choice == 4){
      cout &lt;&lt; "Goodbye!" &lt;&lt; endl;
              keepGoing = false;
          }
      }
          return 0;
  }
  </code></pre>