Name hiding in C++

Question | Apr 19, 2016 | hkumar 

This question is on Name Hiding in C++. The code below defines 'Account' and 'CheckingAccount' classes with Credit() methods:

class Account {
public:

    Account():balance(0){}

    void Credit(int amount) { 
        balance += amount;
    }

    void Credit(double amount) {
        balance += amount;
    }
    double balance;
};

class CheckingAccount : public Account
{
public:
    void Credit(int amount) {
        balance += amount;
    }
};

Create an instance of CheckingAccount class and call Credit():

CheckingAccount ca;
ca.Credit(10.4);

What is the value of CheckingAccount::balance now?

2015 nextptr