I need to write a program with 9 files: 4 header files with 4 implementation files and one Driver. There will be one base class (Account) and 2 subclasses (Checking,Saving). The last of the four classes is Customer; Account has a Customer data member and uses it in some of its functions. The process of what is supposed to happen is self-explanatory based on the header file.
I didn't include my saving and chekcing class files, because my inheritance parts of this code is working perfectly.
I have a problem with composition which are account class and customer class. my output does not display name and accountId for customer class member variable.
my output looks like:
Savings Account:
Name:
Account #:
Balance: $ 1540
Account class constructor has to call overloaded assignment operator from customer class.
and Account class view() funtion calls customer view() function to display customer member variable name and accountID. (Which is my problem here)
The test.cpp file is already given so I can't change anything in test.cpp.
Without seeing what the constructors for Saving and Checking are doing, it's hard to tell. What are they doing with the Customer objects that are passed in? Which constructors are they calling on Account?
Do you really need the default constructor on Account? Is it ever used? Will you ever need to create an Account object without knowing the customer etc?
Account class default constructor is not ever used. But the direction of this assignment wants to write that (initialize the balance (member variable of account)).
In function ‘int main()’:
211:61: error: no matching function for call to ‘Checking::Checking(Customer&, double&, bool&)’
211:61: note: candidates are:
160:1: note: Checking::Checking(float, Customer, bool)
155:1: note: Checking::Checking()
131:7: note: Checking::Checking(const Checking&)
Liar.
Your Customer assignment operator is wrong. It should be equivalent to `strcpy()'
However, you don't need to define it (as you didn't need a copy constructor or a destructor)
Also, #include <string> is for `std::string', you need #include <cstring>