Четверг, Сентябрь 24, 2020

Clown

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace prog1
{
    interface IClown
    {
        void Honk();
        string FunnyThingIHave { get; }

    }
}

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace prog1
{
    class TallGuy:IClown
    {
        public string Name;
        public int Height;
        public void TalkAboutYourself()
        {
            MessageBox.Show("Меня зовут " + Name +
                " я ростом " + Height + " см.");
        }
        public string FunnyThingIHave{
            get{return  "большие eggs";}
        }
        public void Honk()
        {
            MessageBox.Show("Хуясе");
        }
    }
}

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace prog1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            TallGuy tallGuy = new TallGuy() { Height = 190, Name = "Джими" };
            tallGuy.TalkAboutYourself();
            MessageBox.Show(tallGuy.FunnyThingIHave);
            tallGuy.Honk();
        }
    }
}


 

НАЗАД                                                                                                                                         ДАЛЕЕ


Back to Top