Advertisement
tomba2k

instance

Jan 10th, 2015
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace CalculatorTest
  8. {
  9.     public interface ICalculator
  10.     {
  11.         int writeNumber();
  12.         string writeText { get; set; }
  13.         int operand1 { get; set; }
  14.         int operand2 { get; set; }
  15.     }
  16.     public class Calculator : ICalculator
  17.     {
  18.         public string writeText { get; set; }
  19.         public int operand1 { get; set; }
  20.         public int operand2 { get; set; }
  21.  
  22.         public int writeNumber()
  23.         {
  24.             return operand1 + operand2;
  25.         }
  26.  
  27.         public Calculator(/*int operand1, int operand2*/)
  28.         {
  29.             /*this.operand1 = operand1;
  30.             this.operand2 = operand2;*/
  31.         }
  32.     }
  33.  
  34.     class Program
  35.     {
  36.         static void Main(string[] args)
  37.         {
  38.             ICalculator Clc = new Calculator(/*50, 31*/);
  39.             Clc.writeText = "Hello!";
  40.             Clc.operand1 = 50;
  41.             Clc.operand2 = 31;
  42.             Clc.writeNumber();
  43.             Console.WriteLine(Clc.writeText);
  44.             Console.WriteLine(Clc.writeNumber());
  45.         }
  46.     }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement