Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace lab3_zad1
- {
- public class List
- {
- List next;
- public object val;
- public void Add(object val)
- {
- if (next != null) { next.Add(val); }
- else
- {
- this.next = new List();
- this.next.val = val;
- }
- }
- public object Top() { return this.val; }
- }
- class Program
- {
- static void Main(string[] args)
- {
- List l = new List();
- l.Add(497387);
- l.Add(8);
- Console.WriteLine(l.Top());
- }
- }
- }
Add Comment
Please, Sign In to add comment