I've never had this issue before, it's got to be a really simple mistake im missing here but i just cant figure it out. Here is the error report im getting:
F:\C++\stockType\stockType.h||In function 'std::istream& operator>>(std::istream&, stockType&)':|
F:\C++\stockType\stockType.h|8|error: 'char* stockType::symbol' is private|
F:\C++\stockType\stockType.cpp|28|error: within this context|
F:\C++\stockType\stockType.h|10|error: 'double stockType::openingPrice' is private|
F:\C++\stockType\stockType.cpp|29|error: within this context|
F:\C++\stockType\stockType.h|11|error: 'double stockType::closingPrice' is private|
F:\C++\stockType\stockType.cpp|30|error: within this context|
F:\C++\stockType\stockType.h|12|error: 'double stockType::todayHigh' is private|
F:\C++\stockType\stockType.cpp|31|error: within this context|
F:\C++\stockType\stockType.h|13|error: 'double stockType::todayLow' is private|
F:\C++\stockType\stockType.cpp|32|error: within this context|
F:\C++\stockType\stockType.h|14|error: 'double stockType::prevClose' is private|
F:\C++\stockType\stockType.cpp|33|error: within this context|
F:\C++\stockType\stockType.h|15|error: 'int stockType::volume' is private|
F:\C++\stockType\stockType.cpp|34|error: within this context|
F:\C++\stockType\stockType.h||In function 'std::ostream& operator<<(std::ostream&, const stockType&)':|
F:\C++\stockType\stockType.h|8|error: 'char* stockType::symbol' is private|
F:\C++\stockType\stockType.cpp|42|error: within this context|
F:\C++\stockType\stockType.h|10|error: 'double stockType::openingPrice' is private|
F:\C++\stockType\stockType.cpp|43|error: within this context|
F:\C++\stockType\stockType.h|11|error: 'double stockType::closingPrice' is private|
F:\C++\stockType\stockType.cpp|44|error: within this context|
F:\C++\stockType\stockType.h|12|error: 'double stockType::todayHigh' is private|
F:\C++\stockType\stockType.cpp|45|error: within this context|
F:\C++\stockType\stockType.h|13|error: 'double stockType::todayLow' is private|
F:\C++\stockType\stockType.cpp|46|error: within this context|
F:\C++\stockType\stockType.h|14|error: 'double stockType::prevClose' is private|
F:\C++\stockType\stockType.cpp|47|error: within this context|
F:\C++\stockType\stockType.cpp|17|error: 'float stockType::percent_calc()' is private|
F:\C++\stockType\stockType.cpp|48|error: within this context|
F:\C++\stockType\stockType.cpp|48|error: passing 'const stockType' as 'this' argument of 'float stockType::percent_calc()' discards qualifiers|
F:\C++\stockType\stockType.h|15|error: 'int stockType::volume' is private|
F:\C++\stockType\stockType.cpp|49|error: within this context|
||=== Build finished: 31 errors, 0 warnings ===|
so i obviously cant access my private members, yet i made my functions friends to the class so they would be able to access them.
Try moving the stream overloads implementation into the header.
Edit: And change percent_calc to float stockType::percent_calc() const;
Edit2: Actually, just remove the const from the ostream and add the reference operator to the istream declarations.