View Single Post
Old May 23rd, 2006, 10:29 PM   #21
Mack1982
Programmer
 
Join Date: Dec 2004
Posts: 34
Rep Power: 0 Mack1982 is on a distinguished road
//Implmentation
#include "first.h"
#include <iostream>
using namespace std;

first::first(char n[])
{
	strcpy(fName,n);
}

void first::setName(char n[])
{
	for (int i=0;i<20;i++)
		fName[i] = n[i];
}

char* first::getName()
{
	return fName;
}

First.h
ifndef H_First
#define H_First

class first
{
public:
	first(char[]);
	char* getName();
	void setName(char[]);
private:
	char fName[20];
}
#endif

#include "first.h"
#include <iostream>

using namespace std;

int main()
{
	
	first MyName("Mansoor");
 
	char* TheName = MyName.getName();


	cout << "n " << TheName << endl;

	return 0;

}

I dont see sal.h inclusion anywhere, coud someone check this code by compiling and see if they get the same error. I am guess could be some kind of setting problem perhaps,....

I think i read the rules but i forgot,... because I learned that code tag thingy from there,,.... anyway will be careful next time,..
Mack1982 is offline   Reply With Quote