Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using System.Collections;
  10.  
  11. namespace zad
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         interface I1
  16.         {
  17.             double dodaj(double a, double b);
  18.         }
  19.  
  20.         public class K1 : K2, I1
  21.         {
  22.             public double dodaj(double a, double b) { return a + b; }
  23.             public override double odejmij(double a, double b)
  24.             {
  25.                 return a - b;
  26.             }
  27.         }
  28.  
  29.         public abstract class K2
  30.         {
  31.             public abstract double odejmij(double a, double b);
  32.             public double pomnoz(double a, double b) { return a * b; }
  33.         }
  34.  
  35.         public Form1()
  36.         {
  37.             InitializeComponent();
  38.         }
  39.  
  40.         private void button1_Click(object sender, EventArgs e)
  41.         {
  42.             K1 k1 = new K1();
  43.             textBox3.Text = k1.dodaj(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text)).ToString();
  44.         }
  45.  
  46.         private void button2_Click(object sender, EventArgs e)
  47.         {
  48.             K1 k1 = new K1();
  49.             textBox3.Text = k1.odejmij(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text)).ToString();
  50.         }
  51.  
  52.         private void button3_Click(object sender, EventArgs e)
  53.         {
  54.             K1 k1 = new K1();
  55.             textBox3.Text = k1.pomnoz(Convert.ToDouble(textBox1.Text), Convert.ToDouble(textBox2.Text)).ToString();
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement