Skip to content

Instantly share code, notes, and snippets.

@masleshov
Last active January 13, 2023 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masleshov/0bb21e8a78087451c01291f904fbafe3 to your computer and use it in GitHub Desktop.
Save masleshov/0bb21e8a78087451c01291f904fbafe3 to your computer and use it in GitHub Desktop.
namespace Encapsulation
{
public class BankAccount
{
private string _number;
private int _clientId;
private decimal _amountInUsd;
private decimal _amountInEur;
public void DepositUsd(decimal amount)
{
if (amount <= 0)
{
throw new ArgumentException("Values less or equal zero are not allowed!");
}
_amountInUsd += amount;
}
public void DepositEur(decimal amount)
{
if (amount <= 0)
{
throw new ArgumentException("Values less or equal zero are not allowed!");
}
_amountInEur += amount;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment