Guest User

Untitled

a guest
Jun 13th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace lab3_zad1
  7. {
  8. public class List
  9. {
  10. List next;
  11. public object val;
  12.  
  13. public void Add(object val)
  14. {
  15. if (next != null) { next.Add(val); }
  16. else
  17. {
  18. this.next = new List();
  19. this.next.val = val;
  20. }
  21. }
  22. public object Top() { return this.val; }
  23.  
  24. }
  25. class Program
  26. {
  27. static void Main(string[] args)
  28. {
  29. List l = new List();
  30. l.Add(497387);
  31. l.Add(8);
  32. Console.WriteLine(l.Top());
  33. }
  34. }
  35. }
Add Comment
Please, Sign In to add comment