Advertisement
desislava_topuzakova

Untitled

Apr 11th, 2020
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace Demo
  6. {
  7. class BankAccount
  8. {
  9. //полета
  10. private int id;
  11. private double balance;
  12.  
  13. //методи
  14. public BankAccount()
  15. {
  16. //ctor + tab + tab
  17. //празен обект ->id = 0, balance = 0
  18. }
  19.  
  20. public BankAccount(int id1, double balance1)
  21. {
  22. //обект -> id = id1, balance = balance1
  23. id = id1;
  24. balance = balance1;
  25.  
  26. }
  27. public int Id {
  28. get
  29. {
  30. return id;
  31. }
  32. set
  33. {
  34. id = value;
  35. }
  36. }
  37. public double Balance
  38. {
  39. get
  40. {
  41. return balance;
  42. }
  43. set
  44. {
  45. balance = value;
  46. }
  47. }
  48. //deposit -> balance += sum
  49. public void Deposit (double sum)
  50. {
  51. this.balance += sum;
  52. }
  53.  
  54. //withdraw -> balance -= sum
  55. public void Withdraw (double sum)
  56. {
  57. this.balance -= sum;
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement