Hi. I am trying to run the below code but I am having an issue compiling. Visual Studio is telling me that I need to create pointers but everytime I try, I run into more issues. Could some please take a look at my code and tell me whats wrong with it?
The VS Errors are below too
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
using namespace std;
class Student
{
private:
long int SSN;
string name;
public:
Student();
Student(string name, long SSN);
long setSSN(long);
string setName(string);
string getName(string name);
long getSSN(long SSN);
};
Student::Student()
{
name= "unassigned";
SSN = 123456789;
}
Student::Student(string name, long SSN)
{
}
long Student::setSSN(long sSSN)
{
sSSN = SSN;
return sSSN;
}
string Student::setName(string sName)
{
sName = name;
return sName;
}
long Student::getSSN(long SSN)
{
if (SSN > 0)
return SSN;
}
string Student::getName(string name)
{
return name;
}
int main()
{
Student student1, student2("John Doe", 123456789);
cout << "Name for student1 is " << student1.getName << "and ssn is " << student1.getSSN;
cout << "Name of student2 is " << student2.getName << "and ssn is " << student2.getSSN;
system("PAUSE");
return 0;
}
|
All errors occur in my main method.
Error 1 error C3867: 'Student::getName': function call missing argument list; use '&Student::getName' to create a pointer to member
Error 2 error C3867: 'Student::getName': function call missing argument list; use '&Student::getName' to create a pointer to member
Error 3 error C3867: 'Student::getName': function call missing argument list; use '&Student::getName' to create a pointer to member
Error 4 error C3867: 'Student::getSSN': function call missing argument list; use '&Student::getSSN' to create a pointer to member
Error 5 error C3867: 'Student::getSSN': function call missing argument list; use '&Student::getSSN' to create a pointer to member
Error 6 error C3867: 'Student::getName': function call missing argument list; use '&Student::getName' to create a pointer to member
Error 7 error C3867: 'Student::getName': function call missing argument list; use '&Student::getName' to create a pointer to member
Error 8 error C3867: 'Student::getName': function call missing argument list; use '&Student::getName' to create a pointer to member
Error 9 error C3867: 'Student::getSSN': function call missing argument list; use '&Student::getSSN' to create a pointer to member
Error 10 error C3867: 'Student::getSSN': function call missing argument list; use '&Student::getSSN' to create a pointer to member