error C2248: 'record::id_number' : cannot access private member declared in class 'record'
error C2248: 'record::type' : cannot access private member declared in class 'record'
error C2248: 'record::price' : cannot access private member declared in class 'record'
error C2248: 'record::num_in_stock' : cannot access private member declared in class 'record'
error C2248: 'record::title' : cannot access private member declared in class 'record'
error C2248: 'record::author_artist' : cannot access private member declared in class 'record'
error C2248: 'record::year' : cannot access private member declared in class 'record'
The program is suppose to find a certain data type and add the number in stock of the same data type.
___________________________________________________________record.h
#include <iostream>
#include <fstream>
#include <string>
#ifndef RECORD_H
#define RECORD_H
#endif
using namespace std;
class record
{
private:
int id_number;
string type;
double price;
int num_in_stock;
string title;
string author_artist;
int year;
public:
record();
record(int new_id_number, string new_type, double new_price, int new_num_in_stock,
string new_title, string new_author_artist, int new_year);
~record();
I didn't read all of your code... mainly because you need to use the code header files(button on the right looks like <>). I can tell you right now by looking at your errors though that:
'record::id_number', 'record::type', 'record::price', 'record::num_in_stock', 'record::title', 'record::author_artist', 'record::year'
all need to be in the PUBLIC part of your class, not in the PRIVATE.
Private is for only the class to use and is never called anywhere outside of the class. Public is called outside of the class(usually in the program)
You might consider making void read_all_records a friend of the class, although the more usual thing to do would be to define a function that reads one record as a friend of the class and use that within read_all_records. Or you could read the values into intermediary variables and then use the setter functions.
In num_in_inventory_of_type you just need to use the appropriate getter and setter functions.