Question: In a header file, create an Account class that a bank might use to represent customers' bank accounts. Include a private data member called balance
In a header file, create an Account class that a bank might use to represent customers' bank accounts. Include a private data member called balance (of type int) to represent the account balance. Provide a constructor that has a parameter and use it to initialize the data member. Provide a public member function getBalance, which should return the balance. Provide a public member function setBalance, that has a parameter and assigns the parameter to the data member. Write a complete program that will have a main function. Assume main function and class definition are in separate files. In main, create an object of class Account and initialize the balance to 500. From main, change the balance of same Account object to 1000. From main, print balance of same Account object
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
