why this does not work ?

in main.cpp==>

#include <bits/stdc++.h>
#include "myclass.h"
#include<string.h>

using namespace std;

int main()
{
string name="harshit";
myclass obj;
obj.printcrap(name);

return 0;
}

in myclass.h==>

#ifndef MYCLASS_H
#define MYCLASS_H

class myclass
{
public:
myclass();
void printcrap(string);
protected:
private:
};

#endif // MYCLASS_H


in myclass.cpp==>

#include <bits/stdc++.h>
#include "myclass.h"
#include<string.h>

using namespace std;

myclass::myclass()
{
}

void myclass::printcrap(string x)
{
cout<<"i am "<<x<<endl;
}
You should probably be including <string> instead of <string.h>.

What errors are you getting?

Please use [code] tags.
Topic archived. No new replies allowed.