I'm not sure what I am doing wrong here, but my class will not compile. I have to declare my input file as private and then open in my destructor. I then have to close it in my destructor when I am done using it. Any ideas?
Code:
#ifndef NUM_H
#define NUM_H
#include <iostream>
#include <fstream>
class num_info
{
public:
int num; // 1 field in array
}; //end class rand_info
#endif
//Make use of above class to declare an array of class rand_info
#ifndef NUM_FILE_H
#define NUM_FILE_H
#define MAX 10
class num_class
{
private:
class num_info num_ary [MAX]; //an array to store 1 field of num_info
int count; //number of records stored in array
int largest, smallest; //largest and smallest number in file
//int infile;
int ifstream infile; // internal name for input file
public:
num_class (); //constructor
~num_class (void); //destructor
void read_ary (void); //Reads data in the file and keeps track of number of data items read.
void print_ary (char ch);
//void lasm_ary (void);
//void sort_ary (void);
//void comp_frequency (void);
//void print_recs (char ch); //print records in array
//void comp_grades (void); //compute letter grades
//void alphabetize (void); //alphabetize records by name
}; //end class
#endif