Can any one help me with these codes: i m freaking out here

I split my program in 3 parts.
1. main - prac.cpp
2. interface - base.h
3. implementation - base.cpp

in prac.cpp the code is:

#include <iostream>
using namespace std;

#include "base.h"

int main(){
	Base ob;

	ob.set();
	ob.get();

	system("pause");

	return 0;
}

in base.h the code is:

#ifndef BASE_H
#define BASE_H

#include <string>

class Base{
	string word;
public:
	void get();
	void set();
};

#endif

and in base.cpp the code is:

#include "base.h"

void base::set(){
	cin >> word;
}
void base::get(){
	cout << word << endl;
}

i got this error: "Error 1 error C2146: syntax error : missing ';' before identifier 'word' in "base.h" " in visual 2008


any help is highly appreciated...... thanks in advance

Re: Having problem with interfacing and implementation in C++ project 80 80

try
std::string word
std::cin
std::cout

Re: Having problem with interfacing and implementation in C++ project 80 80

#include <iostream> first in your base.h

Re: Having problem with interfacing and implementation in C++ project 80 80

#include <iostream> first in your base.h

can u please explain why? i've used it already but no good...:(
why do u think i've to include it??

Re: Having problem with interfacing and implementation in C++ project 80 80

pls explain, why isn't this working?? what's wrong with this code??

Re: Having problem with interfacing and implementation in C++ project 80 80

i got this error: "Error 1 error C2146: syntax error : missing ';' before identifier 'word' in "base.h" " in visual 2008

the error you are getting for "string". you will need to tell the compiler where string is defined. cin, cout are defined in iostream.h header file under namespace std. Also string is defined under std namespace.

Re: Having problem with interfacing and implementation in C++ project 80 80

try
std::string word
std::cin
std::cout

Thanx it worked..:) but can you pls explain why my code isn't working. it seemed to me i got everything right. i m confused here...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.