Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. #### program.cs
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApp2
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. while (true)
  15. {
  16. var abc = new Auto();
  17. abc.PrzedstawSie();
  18. break;
  19. }
  20.  
  21.  
  22. Console.ReadLine();
  23. }
  24. }
  25. }
  26.  
  27.  
  28.  
  29. ### auto.cs
  30. using System;
  31. using System.Collections.Generic;
  32. using System.Linq;
  33. using System.Text;
  34. using System.Threading.Tasks;
  35.  
  36. namespace ConsoleApp2
  37. {
  38. class Auto
  39. {
  40. string carname, marka;
  41.  
  42. public Auto()
  43. {
  44. string name = "domyslne";
  45. Console.WriteLine("Stworzyłeś auto {0}", name);
  46. carname = name;
  47. marka = "audi";
  48. }
  49.  
  50. public Auto(string name) {
  51. Console.WriteLine("Stworzyłeś auto {0}", name);
  52. carname = name;
  53. marka = "audi";
  54. }
  55.  
  56. ~Auto()
  57. {
  58. Console.WriteLine("zamykam auto");
  59. }
  60.  
  61. public void PrzedstawSie()
  62. {
  63. Console.WriteLine(carname);
  64. mareczka();
  65. }
  66.  
  67. private void mareczka()
  68. {
  69. Console.WriteLine("a marka to {0}", marka);
  70. }
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement