2026-08-11 17:40:36 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
namespace oop {
|
|
|
|
|
|
|
|
|
|
class BankAccount {
|
|
|
|
|
public:
|
|
|
|
|
explicit BankAccount(std::string owner, double balance = 0.0);
|
|
|
|
|
|
|
|
|
|
[[nodiscard]] auto owner() const -> const std::string&;
|
|
|
|
|
[[nodiscard]] auto balance() const -> double;
|
|
|
|
|
|
2026-08-15 17:43:30 +03:00
|
|
|
void deposit(double amount) pre(amount > 0);
|
|
|
|
|
auto withdraw(double amount) -> bool pre(amount > 0);
|
2026-08-11 17:40:36 +03:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::string owner_;
|
|
|
|
|
double balance_;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace oop
|