|
-
April 3rd, 2009, 03:21 AM
#4
Re: Simple problem
 Originally Posted by mayo88
Im very Confused where to start the practical can anyone give me any tips etc?
class Student {
private:
string studentName; // Would this be initialising a student's name and program code to empty strings.??????
string studentProgramCode;
public:
/**
* Default constructor.
* Creates an empty Student object by initialising a student's name and
* program code to empty strings.
*/
Student(); //Default constructor.???
/**
* Constructor.
* Creates a Student object with the given name and program code.
*/
Student(const string& name, const string& programCode);
/**
* return the name of this student.
*/
string getName()const;
ok so i created another file named Students.cpp.
Ive started writing it... as shown below:
#include "Student.h"
#include <cstdlib>
#include <iostream>
Student::Student()
{
studentName = "NAME";
studentProgramCode = "CODE";
}
Student::Student(const string& name, const string& programCode)
Student::string getName()
{
return studentName;
}
}
I want to test if its working or not? but i keep getting errors:
--------------------Configuration: Assignment - Win32 Debug--------------------
Compiling...
Student.cpp
Prac1\Student.cpp(14) : error C2039: 'string' : is not a member of 'Student'
prac1\student.h(22) : see declaration of 'Student'
prac1\Student.cpp(14) : error C2146: syntax error : missing ';' before identifier 'string'
prac1\Student.cpp(14) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
prac1.exe - 3 error(s), 0 warning(s)
any ideas?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|