You are on page 1of 3

Лабораторна робота № 4

Тема: Агрегація .Використання властивостей.

Мета: Одержати практичні навички створення об'єктів-груп (агрегація) і


використання методів-ітераторів.
Завдання:

14. Дата створення –> Навчальний заклад

Код програми :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace OOP
{
static class Program
{
/// <summary>
/// Главная точка входа для приложения.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
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 KulganMan
{
class VUZ
{
Datas dete;
string Name;
DateTime vul;
TextBox t1 = Application.OpenForms["Form1"].Controls["textBox1"] as TextBox;
public VUZ(Datas c1)
{
this.dete = c1;
}
public void wwid(DateTime sd)
{
Name = t1.Text;
vul = dete.wiw(sd);

Змн. Арк. № докум. Підпис Дата


Розроб. Дядик Літ. Арк. Аркушів
Агрегація .Використання
Перевір. Стукан 1 3
властивостей
Н. Контр. ХПК
Затверд.
}
public void wiwid()
{
TextBox t = Application.OpenForms["Form1"].Controls["textBox4"] as TextBox;
t.Text = t.Text + Name + " " + vul.ToShortDateString() + " ";

}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KulganMan
{
class Datas
{
DateTime daat;
public DateTime wiw(DateTime c1)
{
daat = c1;
return c1;
}

}
}
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 KulganMan
{
public partial class Form1 : Form
{
List<VUZ> ar = new List<VUZ>();
public Form1()
{
InitializeComponent();
}

private void Button2_Click(object sender, EventArgs e)


{
Datas a1 = new Datas();
VUZ a2 = new VUZ(a1);
a2.wwid(Convert.ToDateTime(textBox2.Text));
ar.Add(a2);
textBox1.Clear();
textBox2.Clear();
}

private void Button1_Click(object sender, EventArgs e)


{
textBox4.Clear();
for (int i = 0; i < ar.Count; i++)
{
((VUZ)ar[i]).wiwid();
}
}
}
}

Арк.

2
Змн. Арк. № докум. Підпис Дата
Висновок. На цій лабораторній роботі я одержав практичні навички
створення об'єктів-груп (агрегація) і використання методів-ітераторів.

Арк.

3
Змн. Арк. № докум. Підпис Дата

You might also like