Okay, I cannot figure this out. I still get the same error:
Error 1 error C2039: 'function' : is not a member of 'D'
Here's what I have:
Class A.h:
#pragma once
#include <string>
using namespace std;
class D;
class A
{
public:
void function(string s);
friend class D;
private:
string name;
string email;
};
Class D.h:
#pragma once
#include <vector>
#include "A.h"
class L;
class ListOfD;
class D
{
public:
friend class L;
friend class ListOfD;
private:
//not important right now
};
Class L.cpp(this is where the error is):
#include "L.h"
string L::somethingnotimportant(string & command)
{
string result;
if(command.substr(0,4)=="some")
{
string parameter=command.substr(5,9999);
D p;
---------> p.function(parameter);
lop.lastID++;
p.patronIdNumber = lop.lastID;
lop.add(p);
}
else if(command == "PRINTP")
{
//result = printp();
}
else if(command == "QUIT")
{
result = "Goodbye!";
}
else
{
result = "UNKNOWN COMMAND";
}
return result;
}
Okay, I think thats enough code to see the problem. I left out some information, so no one steals this code. Anyways, the function from class A is suppose to be inherited from class D, as well as the two string variables, right? Because nothing from class A can be used unless I create a new object A.