Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace WindowsFormsApplication3
- {
- public partial class Form1 : Form
- {
- class cmath
- {
- public int tambah (int a, int b)
- { return a + b;
- }
- public int kurang ( int a , int b )
- {
- return a - b;
- }
- }
- class cmath2 : cmath
- {
- public int kali ( int a, int b )
- {
- return a * b;
- }
- public int bagi ( int a , int b )
- {
- return a / b;
- }
- }
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- cmath vcmath = new cmath();
- int vhasil;
- vhasil = vcmath.tambah(1, 2);
- MessageBox.Show(vhasil.ToString());
- }
- private void button2_Click(object sender, EventArgs e)
- {
- cmath2 vcmath2 = new cmath2();
- int vhasil;
- vhasil = vcmath2.tambah(1, 2);
- MessageBox.Show(vhasil.ToString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement