Проблема с перегрузкой

Помогите, пожалуйста. Нужная переменная не перегружается.

Class User: (наследуемый от Account)

void User::resetAccount(){
   !Account();
}

Class Account (Наследуемый от Money)

    //Account.h
    class Account{
private:
    string fio;
    long id; //id
    int pin;
    Money m;
public:
    Account();
    Account(string FIO, long Ident, int Pin, Money M);
    Account operator!();

    //Account.cpp
    Account Account::operator!(){
    this->m.setSum(0);
    return *this;
    }

Метод setSum() в Money работает корректно. Спасибо.


Ответы (1 шт):

Автор решения: Harry

Думаю, вы хотите

void User::resetAccount(){ !*this; }

Ну, или

void User::resetAccount(){ this->operator!(); }

Если User и в самом деле корректно наследует Account.

→ Ссылка