I'm trying to return a pointer to an array for my function prototype.
class NAV
{
string date;
float nav;
public:
NAV(const string&);
};
const int HistorySize = 300;
class MutualFund
{
string ticker;
NAV* history[HistorySize];
public:
MutualFund(const string& ticker_, const string& historyFile);
~MutualFund();
NAV** getArray() const{return history;}
void report() const;
};
For NAV** getArray() const{return history;}, I'm getting a compiler error:
error: invalid conversion from 'NAV* const*' to 'NAV**' [-fpermissive]
Any ideas?
return historyreturnsNAV* const *but you are trying to return it asNAV**.historyto be 300 pointers toNAV? Or ishistorysupposed to be an array of 300NAVs?error C2440: 'return': cannot convert from 'NAV *const [300]' to 'NAV **'