I am trying to pass an object (of class Stock) by const reference to a function of another class (called Algorithms).
//Algorithms.h
#pragma once
class Algorithms
{
public:
Algorithms(void);
~Algorithms(void);
int Algorithms::doAnalysis(const Stock&);
};
The implementation of doAnalysis is
#include "StdAfx.h"
#include "Algorithms.h"
#include "Stock.h"
#include <vector>
using namespace std;
Algorithms::Algorithms(void)
{
}
Algorithms::~Algorithms(void)
{
}
int Algorithms::doAnalysis(const Stock &S)
{
//Do Something
return 0;
}
The class Stock has the following constructors
public:
Stock(std::string market, std::string symbol);
Stock(std::string market, std::string symbol, std::string start_date, std::string end_date);
I am getting the following error:
Error: declaration is imcompatible with "int Algorithms::doAnalysis(const<error-type> &)" declared at line 8 of Algorithms.h
I understand that the class Stock is not being found. How should I declare the doAnalysis method in Algorithms.h so that it is found? Stock is not a derived class.
Thanks for your help. I am new to C++.