I get multiple errors whenever I try to compile this header file, and I don't see any problem with it. Some of the errors are, "expected ')' before 'b'", referring to the second constructor, and "string does not name a type", referring to the accessor.
I don't really understand the way Xcode link files. It seems like even if the project does not include this file, I can still just use #include command to include the file. If that is the case, then what does this project thing do? What I would prefer is actually to have different main.cpp, one of which is the program I want to write, and the other one to be used as a testing program for the classes. How do I do that? Should I create two projects?
Code:
#include <string>
#include <vector>
struct amount
{
int longAmount;
int shortAmount;
double delimiter;
};
struct price
{
double bid;
double ask;
};
class pair
{
public:
//contructor
pair();
pair(string b, string q, price p, vector<amount> &chart);
pair(string b, string q, vector<amount> &chart);
//modifier
//accessors
string baseCurrency() const;
string quoteCurrency() const;
double price() const;
vector<amount> amountChart() const;
vector<int> currentLongPos() const;
vector<int> currentshortPos() const;
private:
string base;
string quote;
price currentPrice;
vector<amount> chart;
vector<int> longPos;
vector<int> shortPos;
};
I don't really understand the way Xcode link files. It seems like even if the project does not include this file, I can still just use #include command to include the file. If that is the case, then what does this project thing do? What I would prefer is actually to have different main.cpp, one of which is the program I want to write, and the other one to be used as a testing program for the classes. How do I do that? Should I create two projects?