Inheritance & Class Help
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Inheritance & Class Help

Threaded View

  1. #1
    Join Date
    Apr 2012
    Posts
    1

    Inheritance & Class Help

    I have been assigned a project that deals with Inheritance and classes. I am having trouble calling between classes. I am very ignorant in the area of inheritance I'm not anywhere close to a mediocre programmer. Any help is very much appreciated.

    I have deleted the details of the functions under the check and save classes to save anyone from having to filter through the massive annoying lines of useless code

    There are 4 lines of code under class account that are throwing me errors.
    Code:
    class account
    {
    	private:
    		string cust_name;
    		char account_type;
    		
    	public:
    		void get_cust_name()
    		{
    			cout << "\n\nEnter Customer Name : ";
    			cin >> cust_name;
    		}
    		void main_menu()
    		{
    			//Displays Main menu
    		}
    		void new_account()
    		{
    			char ch;
    			cout << "\n\nWhat type of account would you like to add (c for checking, s for savings)";
    			cin >> ch;
    			if(ch == 'c' || ch == 'C')
    			{
    // Error line		check.new_chk_account();
    			}
    			if(ch == 's' || ch == 'S')
    			{
    // Error line		save.new_sav_account();
    			}
    			main_menu();
    		}
    		void display_all()
    		{
    // Error line	cout << "Checking Account Information:\n"; //<< check.chk_balance << endl;
    // Error line	cout << "Savings Account Information:\n"; //<< save.sav_balance << endl; 
    			main_menu();
    		}
    };
    
    
    class check : public account
    {
    	private:
    		int chk_account_num;
    		double chk_acc_bal;
    
    	public:
    		//Checking account functions
    		void chk_acc()
    		{
    			//Displays checking account menu
    		}
    		void chk_deposit()
    		{
    		}
    		void chk_withdraw()
    		{
    		}
    		void chk_transfer()
    		{
    		}
    		void chk_balance()
    		{
    		}
    		void month_fee()
    		{
    		}
    		void new_chk_account()
    		{
    		}
    };
    
    class save : public account
    {
    	private: 
    		int sav_account_num;
    		double sav_acc_bal;
    		
    	public:
    		//Savings account functions
    		void sav_acc()
    		{
    			//Savings account menu
    		} 
    		void sav_deposit()
    		{
    		}	
    		void sav_withdraw()
    		{
    		}	
    		void sav_transfer()
    		{
    		}
    		void sav_balance()
    		{
    		}
    		void intrest()
    		{
    		}
    		void min_req()
    		{
    		}	
    		void new_sav_account()
    		{
    		}
    		
    };
    I was thinking of using pointers, but this entire code might be useless and having to scrap this would be a suprise.
    Last edited by Cimperiali; April 26th, 2012 at 12:18 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center