Just begin to study the C++ class. I do not know how to solve the question, Looking for someone to help me.

  1. Create a class definition for an object called Account. Add a constructor and destructor to it.
  2. Create a class CheckingAccount and make it a child class of Account.
  3. Create a second class named Savings account and also make this class a derived class of Account.
  4. Create private data members on the derived classes to represent balance and overdraft limits.
  5. Implement the following class methods on classes that you think are the appropriate ones.
    getBalance
    getAnnualInterestRate
    withdraw
    deposit
    getMonthlyInterest
    Write a main function that instantiates a checking and savings account, and then deposit $100 into each account and set an overdraft limit on the checking account of $50.

Recommended Answers

All 3 Replies

class Account
    {
        Account()
            {
            }

        ~Account()
            {
            }
    }

class Savings : public Account
{

}

class Checking : public Account
{

}

There's your start, now show some willing. Few will do your homework for you.

Just this change:

class Account
    {
    public:
        Account()
            {
            }
        virtual ~Account()
            {
            }
    private:
        // Private parts here.
    }
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.