I am testing the concept of putting classes in separate files for the first time and while executing getting an error. Please help
main.cpp this is the main file
#include <iostream>
#include <string>
#include "newClass.h"
using namespace std;
int main()
{
newClass obj1("mayan");
cout << obj1.doneName() << endl ;
}
newClass.h this is the separate header file
#ifndef NEWCLASS_H
#define NEWCLASS_H
#include <iostream>
#include <string>
#include <string>
class newClass{
private:
string name;
public:
newClass(string z) ;
string doneName();
};
#endif // NEWCLASS_H
and this is the separate newClass.cpp file
#include "newClass.h"
#include <iostream>
#include <string>
using namespace std;
newClass::newClass(string z)
{
name = z ;
}
string newClass :: doneName()
{
return name;
}