New to classes. Getting alot of errors when calling the private member variables (from down in main). Most are telling me either i can't access the private member variable IDs or the other member variables i'm attempting to access (debit, credit, balance) are undefined ('identifier not found'). Also getting 'overloaded member function' errors for just about each function. Help please?

#include <iomanip>   
#include <iostream>
#include <fstream>
#include <stdio.h> 
#include <string.h>
#define SIZE 50
using namespace std;

class CorporateClass {
	public:
		CorporateClass(int I): ID(I) { }//contstructor method
		CorporateClass(){} //constructor method

		//int GetID(){ return ID; }   //accessor?

		void initialize(ifstream text, float &, float &, float &);
		void div_update(float, float, float);
		void add_credit(ifstream text, float &, float &);
                                void ded_debit(ifstream text, float &, float &);
		void HQset();
	private:
		int ID; //4 digit int values
		float balance;
		float credit;
		float debit;
};


//** ******* **
void CorporateClass::initialize(ifstream& text, float &debit, float &credit, float &balance) {            
//GIVEN: Open input stream & index variable.
//TASK: Initializes variables with data from input stream.
//RETURNS: Variables now containing initialized data.  
	text>>balance;
	text>>credit;
	text>>debit;
}


//** ******* **
void CorporateClass::div_update(float total_d, float total_c, float total_b) {            
//GIVEN: Corporate update variables.
//TASK: Update Corporate update variables.
//RETURNS: Updated Corporate updated variables.   

}


//** ******* **
void CorporateClass::add_credit(ifstream text, float &total_c, float &total_b) {
//GIVEN: Open input stream & two corporate update variables.
//TASK: Add a debit to the division's budget.
//RETURNS: Updated corporate update variables.
	float amt_toadd;
	text>>amt_toadd;
	credit+=amt_toadd;
	balance+=amt_toadd;

	total_c+=amt_toadd;
	total_b-=amt_toadd;
	return;
}


//** ******* **
void CorporateClass::ded_debit(ifstream text, float &total_c, float &total_b) {
//GIVEN: Open input stream & two corporate update variables.
//TASK: Ded a debit from the division's budget.
//RETURNS: Updated corporate update variables.
	float amt_toded;
	text>>amt_toded;
	debit-=amt_toded;
	balance-=amt_toded;

	total_d-=amt_toded;
	total_b+=amt_toded;
	return;
}


//** ******* **
void CorporateClass::HQset(ifstream& text, ofstream& output, int &i) {
//GIVEN: None.
//TASK: None.
//RETURNS: None.

}


//** ******************************** **
void main(void) {
      //** ********** **
      int i=0;
      char temp; 
      int tempID;
      ifstream text("data7.txt", ios::in);
      ofstream output("output.txt", ios::out | ios::app);
      float total_d=0.00, total_c=0.00, total_b=0.00, total_f=0.00;//update variables.
	                                                            
                         //objects initialized with ID values
      CorporateClass HQ(0000), div1(2017), div2(3026), div3(4039), div4(6049), div5(7052);


      text.get(temp);
      if(text.is_open())
            while(i<=SIZE && temp!='Q')   
            {
	 if(temp=='I') 
	 { 	
	        text>>tempID;
                        if(tempID==div1.ID)
	              div1.initialize(text, debit, credit, balance);
	        else if(tempID==div2.ID)
	              div2.initialize(text, debit, credit, balance);
	        else if(tempID==div3.ID)
	              div3.initialize(text, debit, credit, balance);
	        else if(tempID==div4.ID)
	              div4.initialize(text, debit, credit, balance);
	        else if(tempID==div5.ID)
	              div5.initialize(text, debit, credit, balance);
	 }
                 if(temp=='A')
	 {			
	        text>>tempID;
                        if(tempID==div1.ID)
	              div1.add_credit(text, total_c, total_b);
	        else if(tempID==div2.ID)
	              div2.add_credit(text, total_c, total_b);
	        else if(tempID==div3.ID)
	              div3.add_credit(text, total_c, total_b);
	        else if(tempID==div4.ID)
	              div4.add_credit(text, total_c, total_b);
	        else if(tempID==div5.ID)
	              div5.add_credit(text, total_c, total_b);
	 }
                 if(temp=='D')
                 {			
	        text>>tempID;
	        if(tempID==div1.ID)
	              div1.ded_debit(text, total_d, total_b);
	        else if(tempID==div2.ID)
	              div2.ded_debit(text, total_d, total_b);
	        else if(tempID==div3.ID)
	              div3.ded_debit(text, total_d, total_b);
	        else if(tempID==div4.ID)
	              div4.ded_debit(text, total_d, total_b);
	        else if(tempID==div5.ID)
	              div5.ded_debit(text, total_d, total_b);
	 }                  if(temp=='P') { print_budgets(text, output, i); } //Calls function.
                  text.get(temp);		
}




	GetData(text, output, i);                                    //calls main function.

	if(output.is_open())
		output<<endl<<"END OF PROGRAM OUTPUT."<<endl;
}

Most are telling me either i can't access the private member variable IDs or the other member variables i'm attempting to access

private means just exactly that -- only the class itself can access private members. Work around: write get() and put() public methods to make private members available outside the class

class CorporateClass {
public:
    CorporateClass(int I): ID(I) { }//contstructor method
    CorporateClass(){} //constructor method

    void initialize(ifstream text, float &, float &, float &);
    void div_update(float, float, float);
    void add_credit(ifstream text, float &, float &);
    void ded_debit(ifstream text, float &, float &);
    void HQset();

// get methods
    int getID() { return ID; }
    // etc for all other private members you want to
    // give public access

// put methods
    void putID(int id) {this->ID = id;}
// etc for others

private:
    int ID; //4 digit int values
    float balance;
    float credit;
    float debit;
};

Now you can use the put() and get() methods in main

appreciate it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.