class AccountManager
{
private:
Account accountlist[100];
int *accountNumber;
Account* SuperVipAccount;
static int ManagerNumber;
public
int getManagerNumber() const;
};
I have a class like this, and I want to use decrement operator in "getManagerNumber" to let ManagerNumber minus one, what should I do?
ManagerNumber
is a static
member of the AccountManager
(shared across the class and not per object), so you can decrement it very well.
Method's const
correctness doesn't apply to the static
members.
int getManagerNumber() const
{
-- ManagerNumber; // ok
return ManagerNumber;
}