Assume you have the following Bank class. In this code, the withdraw method is our main focus. Its job is to deduct a given amount from the balance and then return the updated balance.

C++

 

x

14

 

1

class Bank {

2

public:

3

    Bank(double balance = 0) {

4

        this->balance = balance;

5

    }

6

7

    double withdraw(double amount) {

8

        balance = balance - amount;

9

        return balance;

10

    }

11

12

private:

13

    double balance;

14

};

As you notice, it can return only a doubleI would say that this function can only speak in “double” language, poor function. 

Assume you have the following Bank class. In this code, the withdraw method is our main focus. Its job is to deduct a given amount from the balance and then return the updated balance.

C++

 

x

14

 

1

class Bank {

2

public:

3

Bank(double balance = 0) {

4

this->balance = balance;

5

}

6

7

double withdraw(double amount) {

8

balance = balance – amount;

9

return balance;

10

}

11

12

private:

13

double balance;

14

};

As you notice, it can return only a double. I would say that this function can only speak in “double” language, poor function.&nbs […]