fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication8
  8. {
  9. class Dane
  10. {
  11. public int a = 1;
  12. }
  13. class Wypisz
  14. {
  15. public static void metoda(Dane d)
  16. {
  17. Console.WriteLine(d.a); // musisz przekazac obiekt dane by moc wyswietlic go.
  18. }
  19. }
  20. class Program
  21. {
  22. static void Main(string[] args)
  23. {
  24. Dane a = new Dane();
  25. Dane b = new Dane();
  26.  
  27. Wypisz.metoda(a); //wypisuje wartosc a w a
  28. Wypisz.metoda(b); //wypisuje wartosc a w b
  29.  
  30. //mozesz tez zmienic dane w a np.
  31. a.a = 5;
  32. Wypisz.metoda(a);
  33. }
  34. }
  35. }
Success #stdin #stdout 0.04s 23968KB
stdin
Standard input is empty
stdout
1
1
5