1. Do I have the #ifndef #define #endif in the correct places? and did I name them correctly? |
Yes, you have them in the right place. They're supposed to protect the entire contents of the header file, and that's what you've done.
There's no "right" name and "wrong" name for them, but the important thing is that each header file uses a different symbol from all the other header files. Basing the symbol on the name of the header file is the usual way of doing that, so that you've done is fine.
2. In account.h class. There is a private variable that is suppose to be named "cust". The word object is throwing me off. What type of variable am I suppose to declare it?. |
Do you have a Customer class? If not, are you supposed to write one? Because it sounds like what you're supposed to use is an object of that class.
3. On account.h for the public member functions, I still don't know 100% how to tell which will be virtual, non-virtual or pure virtual or non pure virtual. (I'll reread the chapter once more). |
A textbook or tutorial will explain this properly, but in a nutshell:
- Use a virtual method if you want to be able to call the method on a base class pointer, and automatically know that it should really be calling the method on the derived class that the pointer actually points to.
- Use a non-virtual method if you want to be able to call the method on a base class pointer, and
not call the method on the derived class, i.e. call the base-class version of the method instead, regardless of what the pointer actually points to.
- Use a pure virtual method when you're defining an interface, i.e. when you're saying that the class has no definition for that method, but a derived class
must define its own version of that method.
4. Inside account.cpp on the function named "getBalance()". Is it safe to call it a "int" function since its purpose is to "return Balance". |
You define the return type to say what type of data is being returned. If you're returning the balance, then that's a float, so the return type of
getBalance() should be float, not int.
5. One thing that has been bugging me is how do I call a constructor from another subclass to another. I still haven't grasped that idea or know how to do it. |
That happens automatically. When you create an object of a given class, then not only is the constructor of that class called automatically, but so are the constructors of the base classes.
If the constructor(s) of your base classes need to take arguments, then there's a syntax for defining how the constructor of the subclass passes arguments to the constructors of the base classes. Your textbook should explain that.
6. On the member function "makeWithdrawal()" should I keep it as a Void function or should I make it to a boolean function?. |
That's up to you. Do you want it to be able to pass information back to the calling code in the form of a boolean?