Why is it an error to add a const modifier, as shown to the declaration for the member function input given here?
```
class BankAccount
{
public:
void input( ) const;
// other members
};
```
If an input routine actually contains code to do input, the function will not compile.
The purpose of and input function is to change the state of the calling object. The purpose of the const modifier placed as shown is to prevent compiling of code that changes the state of the calling object.
Computer Science & Information Technology
You might also like to view...
What is a preformatted database designed for a specific purpose?
A) Pattern B) Template C) Starter D) Sample
Computer Science & Information Technology
Declan just purchased the Microsoft Office suite and is learning about all of the program options. Declan learns that the Microsoft Office spreadsheet application is ____.
A. Word B. Access C. PowerPoint D. Excel
Computer Science & Information Technology