String type member function in class
Aug 2, 2011 at 3:57am UTC
I'm currently practicing putting my classes in separate .h/.cpp files, and I stumbled upon an error.
One of my member functions return a string value.
Here's the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include "Conversation.h"
#include <iostream>
#include <string>
using namespace std;
void Conversation::setSay(){
cin >> say;
}
string Conversation::getSay(){
return say;
}
I'm using Microsoft Visual C++ 2010 Express, and I get a red line under "getSay()".
It says "declaration is incompatible with "<error-type> Conversation::getSay()"
Am I doing something wrong? :[
Aug 2, 2011 at 4:21am UTC
Can we see Conversation.h?
Topic archived. No new replies allowed.