Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void Main(string[] args)
- {
- Table bla = new Table(5);
- int b = bla.get();
- Table liran = new Table(3);
- Table ido = new Table(8);
- int c = ido.get() + liran.get();
- Console.WriteLine("do you want to change the height of the Table?");
- string answer = Console.ReadLine();
- if (answer == "yes")
- {
- Console.WriteLine("Enter the height of the table");
- int height = int.Parse(Console.ReadLine());
- liran.set(height);
- Console.WriteLine("the height of your table is now: " + liran.get());
- }
- }
- }
- class Table
- {
- private int height;
- public Table(int a)
- {
- height = a;
- }
- public int get()
- {
- return height;
- }
- public void set(int change)
- {
- height = change;
- }
- }
Add Comment
Please, Sign In to add comment