Объектная реализация полиморфного контейнера на основе линейного списка

Теоретическое описание линейного списка с алгоритмами реализации основных операций. Понятия, механизмы объектно-ориентированного программирования. Возможности проектируемого контейнера пользователей, его реализация на основе линейного списка с заголовком.

Рубрика Программирование, компьютеры и кибернетика
Вид курсовая работа
Язык русский
Дата добавления 26.02.2015
Размер файла 475,2 K

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

this. exitToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();

this. справкаToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();

this. dataGridView1 = new System. Windows. Forms. DataGridView ();

this. contextMenuStrip = new System. Windows. Forms. ContextMenuStrip (this.components);

this. добавитьДоToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();

this. добавитьПослеToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();

this. удалитьToolStripMenuItem = new System. Windows. Forms. ToolStripMenuItem ();

this. openFileDialog = new System. Windows. Forms. OpenFileDialog ();

this. saveFileDialog = new System. Windows. Forms. SaveFileDialog ();

this. userType = new System. Windows. Forms. DataGridViewTextBoxColumn ();

this. ColumnName = new System. Windows. Forms. DataGridViewTextBoxColumn ();

this. ColumnPassword = new System. Windows. Forms. DataGridViewTextBoxColumn ();

this. ColumnRights = new System. Windows. Forms. DataGridViewTextBoxColumn ();

this. menuStrip1. SuspendLayout ();

( (System.componentModel. ISupportInitialize) (this. dataGridView1)). BeginInit ();

this. contextMenuStrip. SuspendLayout ();

this. SuspendLayout ();

//

// menuStrip1

//

this. menuStrip1. Items. AddRange (new System. Windows. Forms. ToolStripItem [] {

this. файлToolStripMenuItem,

this. справкаToolStripMenuItem});

this. menuStrip1. Location = new System. Drawing. Point (0, 0);

this. menuStrip1. Name = "menuStrip1";

this. menuStrip1. Size = new System. Drawing. Size (651, 24);

this. menuStrip1. TabIndex = 0;

this. menuStrip1. Text = "menuStrip1";

//

// файлToolStripMenuItem

//

this. файлToolStripMenuItem. DropDownItems. AddRange (new System. Windows. Forms. ToolStripItem [] {

this. createToolStripMenuItem,

this. openToolStripMenuItem,

this. saveToolStripMenuItem,

this. saveAsToolStripMenuItem,

this. closeToolStripMenuItem,

this. exitToolStripMenuItem});

this. файлToolStripMenuItem. Name = "файлToolStripMenuItem";

this. файлToolStripMenuItem. Size = new System. Drawing. Size (48, 20);

this. файлToolStripMenuItem. Text = "Файл";

//

// createToolStripMenuItem

//

this. createToolStripMenuItem. Name = "createToolStripMenuItem";

this. createToolStripMenuItem. Size = new System. Drawing. Size (162, 22);

this. createToolStripMenuItem. Text = "Создать";

this. createToolStripMenuItem. Click += new System. EventHandler (this. onMenuClick_Create);

//

// openToolStripMenuItem

//

this. openToolStripMenuItem. Name = "openToolStripMenuItem";

this. openToolStripMenuItem. Size = new System. Drawing. Size (162, 22);

this. openToolStripMenuItem. Text = "Открыть. ";

this. openToolStripMenuItem. Click += new System. EventHandler (this. onMenuClick_Open);

//

// saveToolStripMenuItem

//

this. saveToolStripMenuItem. Enabled = false;

this. saveToolStripMenuItem. Name = "saveToolStripMenuItem";

this. saveToolStripMenuItem. Size = new System. Drawing. Size (162, 22);

this. saveToolStripMenuItem. Text = "Сохранить. ";

this. saveToolStripMenuItem. Click += new System. EventHandler (this. onMenuSaveButton_Click);

//

// saveAsToolStripMenuItem

//

this. saveAsToolStripMenuItem. Enabled = false;

this. saveAsToolStripMenuItem. Name = "saveAsToolStripMenuItem";

this. saveAsToolStripMenuItem. Size = new System. Drawing. Size (162, 22);

this. saveAsToolStripMenuItem. Text = "Сохранить как. ";

this. saveAsToolStripMenuItem. Click += new System. EventHandler (this. onMenuSaveAsButton_Click);

//

// closeToolStripMenuItem

//

this. closeToolStripMenuItem. Enabled = false;

this. closeToolStripMenuItem. Name = "closeToolStripMenuItem";

this. closeToolStripMenuItem. Size = new System. Drawing. Size (162, 22);

this. closeToolStripMenuItem. Text = "Закрыть";

this. closeToolStripMenuItem. Click += new System. EventHandler (this. onMenuClick_Close);

//

// exitToolStripMenuItem

//

this. exitToolStripMenuItem. Name = "exitToolStripMenuItem";

this. exitToolStripMenuItem. Size = new System. Drawing. Size (162, 22);

this. exitToolStripMenuItem. Text = "Выход";

this. exitToolStripMenuItem. Click += new System. EventHandler (this. onMenuExitButton_Click);

//

// справкаToolStripMenuItem

//

this. справкаToolStripMenuItem. Name = "справкаToolStripMenuItem";

this. справкаToolStripMenuItem. Size = new System. Drawing. Size (65, 20);

this. справкаToolStripMenuItem. Text = "Справка";

this. справкаToolStripMenuItem. Click += new System. EventHandler (this. Help_Click);

//

// dataGridView1

//

this. dataGridView1. AllowUserToAddRows = false;

this. dataGridView1. AllowUserToDeleteRows = false;

this. dataGridView1. AllowUserToResizeRows = false;

this. dataGridView1. Anchor = ( (System. Windows. Forms. AnchorStyles) ( ( ( (System. Windows. Forms. AnchorStyles. Top | System. Windows. Forms. AnchorStyles. Bottom)

| System. Windows. Forms. AnchorStyles. Left)

| System. Windows. Forms. AnchorStyles. Right)));

this. dataGridView1. AutoSizeColumnsMode = System. Windows. Forms. DataGridViewAutoSizeColumnsMode. Fill;

this. dataGridView1. BackgroundColor = System. Drawing. SystemColors. Control;

this. dataGridView1. CellBorderStyle = System. Windows. Forms. DataGridViewCellBorderStyle. Raised;

this. dataGridView1. ColumnHeadersHeightSizeMode = System. Windows. Forms. DataGridViewColumnHeadersHeightSizeMode. AutoSize;

this. dataGridView1. Columns. AddRange (new System. Windows. Forms. DataGridViewColumn [] {

this. userType,

this. ColumnName,

this. ColumnPassword,

this. ColumnRights});

this. dataGridView1. EditMode = System. Windows. Forms. DataGridViewEditMode. EditProgrammatically;

this. dataGridView1. EnableHeadersVisualStyles = false;

this. dataGridView1. GridColor = System. Drawing. SystemColors. ActiveCaptionText;

this. dataGridView1. Location = new System. Drawing. Point (0, 27);

this. dataGridView1. MinimumSize = new System. Drawing. Size (534, 298);

this. dataGridView1. MultiSelect = false;

this. dataGridView1. Name = "dataGridView1";

this. dataGridView1. ReadOnly = true;

this. dataGridView1. RowHeadersWidth = 30;

this. dataGridView1. RowTemplate. ContextMenuStrip = this. contextMenuStrip;

this. dataGridView1. RowTemplate. ReadOnly = true;

this. dataGridView1. ShowEditingIcon = false;

this. dataGridView1. Size = new System. Drawing. Size (651, 305);

this. dataGridView1. TabIndex = 1;

//

// contextMenuStrip

//

this. contextMenuStrip. Items. AddRange (new System. Windows. Forms. ToolStripItem [] {

this. добавитьДоToolStripMenuItem,

this. добавитьПослеToolStripMenuItem,

this. удалитьToolStripMenuItem});

this. contextMenuStrip. Name = "contextMenuStrip";

this. contextMenuStrip. Size = new System. Drawing. Size (172, 70);

this. contextMenuStrip. Opening += new System.componentModel. CancelEventHandler (this. context_Opening);

//

// добавитьДоToolStripMenuItem

//

this. добавитьДоToolStripMenuItem. Name = "добавитьДоToolStripMenuItem";

this. добавитьДоToolStripMenuItem. Size = new System. Drawing. Size (171, 22);

this. добавитьДоToolStripMenuItem. Text = "Добавить до. ";

this. добавитьДоToolStripMenuItem. TextAlign = System. Drawing. ContentAlignment. BottomLeft;

this. добавитьДоToolStripMenuItem. Click += new System. EventHandler (this. addBefore_Click);

//

// добавитьПослеToolStripMenuItem

//

this. добавитьПослеToolStripMenuItem. Name = "добавитьПослеToolStripMenuItem";

this. добавитьПослеToolStripMenuItem. Size = new System. Drawing. Size (171, 22);

this. добавитьПослеToolStripMenuItem. Text = "Добавить после. ";

this. добавитьПослеToolStripMenuItem. TextAlign = System. Drawing. ContentAlignment. BottomLeft;

this. добавитьПослеToolStripMenuItem. Click += new System. EventHandler (this. addAfter_Click);

//

// удалитьToolStripMenuItem

//

this. удалитьToolStripMenuItem. Name = "удалитьToolStripMenuItem";

this. удалитьToolStripMenuItem. Size = new System. Drawing. Size (171, 22);

this. удалитьToolStripMenuItem. Text = "Удалить";

this. удалитьToolStripMenuItem. Click += new System. EventHandler (this. delete_Click);

//

// openFileDialog

//

this. openFileDialog. FileName = "openFileDialog";

//

// userType

//

this. userType. AutoSizeMode = System. Windows. Forms. DataGridViewAutoSizeColumnMode. None;

this. userType. FillWeight = 125.8883F;

this. userType. Frozen = true;

this. userType. HeaderText = "Тип пользователя";

this. userType. Name = "userType";

this. userType. ReadOnly = true;

this. userType. Resizable = System. Windows. Forms. DataGridViewTriState. False;

this. userType. Width = 158;

//

// ColumnName

//

this. ColumnName. AutoSizeMode = System. Windows. Forms. DataGridViewAutoSizeColumnMode. None;

this. ColumnName. FillWeight = 91.37055F;

this. ColumnName. Frozen = true;

this. ColumnName. HeaderText = "Имя";

this. ColumnName. Name = "ColumnName";

this. ColumnName. ReadOnly = true;

this. ColumnName. Resizable = System. Windows. Forms. DataGridViewTriState. False;

this. ColumnName. Width = 115;

//

// ColumnPassword

//

this. ColumnPassword. AutoSizeMode = System. Windows. Forms. DataGridViewAutoSizeColumnMode. None;

this. ColumnPassword. FillWeight = 91.37055F;

this. ColumnPassword. Frozen = true;

this. ColumnPassword. HeaderText = "Пароль";

this. ColumnPassword. Name = "ColumnPassword";

this. ColumnPassword. ReadOnly = true;

this. ColumnPassword. Resizable = System. Windows. Forms. DataGridViewTriState. False;

this. ColumnPassword. Width = 114;

//

// ColumnRights

//

this. ColumnRights. AutoSizeMode = System. Windows. Forms. DataGridViewAutoSizeColumnMode. None;

this. ColumnRights. FillWeight = 91.37055F;

this. ColumnRights. Frozen = true;

this. ColumnRights. HeaderText = "Права доступа";

this. ColumnRights. Name = "ColumnRights";

this. ColumnRights. ReadOnly = true;

this. ColumnRights. Resizable = System. Windows. Forms. DataGridViewTriState. False;

this. ColumnRights. Width = 115;

//

// Form1

//

this. AutoScaleDimensions = new System. Drawing. SizeF (6F, 13F);

this. AutoScaleMode = System. Windows. Forms. AutoScaleMode. Font;

this. ClientSize = new System. Drawing. Size (651, 331);

this. Controls. Add (this. dataGridView1);

this. Controls. Add (this. menuStrip1);

this. KeyPreview = true;

this. MainMenuStrip = this. menuStrip1;

this. Name = "Form1";

this. Text = "Пользователи";

this. FormClosing += new System. Windows. Forms. FormClosingEventHandler (this. FormClosing_Form1);

this. menuStrip1. ResumeLayout (false);

this. menuStrip1. PerformLayout ();

( (System.componentModel. ISupportInitialize) (this. dataGridView1)). EndInit ();

this. contextMenuStrip. ResumeLayout (false);

this. ResumeLayout (false);

this. PerformLayout ();

}

#endregion

private System. Windows. Forms. MenuStrip menuStrip1;

private System. Windows. Forms. ToolStripMenuItem файлToolStripMenuItem;

private System. Windows. Forms. ToolStripMenuItem createToolStripMenuItem;

private System. Windows. Forms. ToolStripMenuItem exitToolStripMenuItem;

private System. Windows. Forms. DataGridView dataGridView1;

private System. Windows. Forms. ToolStripMenuItem openToolStripMenuItem;

private System. Windows. Forms. ToolStripMenuItem saveToolStripMenuItem;

private System. Windows. Forms. ContextMenuStrip contextMenuStrip;

private System. Windows. Forms. ToolStripMenuItem добавитьДоToolStripMenuItem;

private System. Windows. Forms. ToolStripMenuItem добавитьПослеToolStripMenuItem;

private System. Windows. Forms. ToolStripMenuItem удалитьToolStripMenuItem;

private System. Windows. Forms. OpenFileDialog openFileDialog;

private System. Windows. Forms. ToolStripMenuItem saveAsToolStripMenuItem;

private System. Windows. Forms. ToolStripMenuItem closeToolStripMenuItem;

private System. Windows. Forms. SaveFileDialog saveFileDialog;

private System. Windows. Forms. ToolStripMenuItem справкаToolStripMenuItem;

private System. Windows. Forms. DataGridViewTextBoxColumn userType;

private System. Windows. Forms. DataGridViewTextBoxColumn ColumnName;

private System. Windows. Forms. DataGridViewTextBoxColumn ColumnPassword;

private System. Windows. Forms. DataGridViewTextBoxColumn ColumnRights;

}

}

userForm. Designer. cs

namespace курсовая_2курс

{

partial class userForm

{

// / <summary>

// / Required designer variable.

// / </summary>

private System.componentModel. IContainer components = null;

// / <summary>

// / Clean up any resources being used.

// / </summary>

// / <param name="disposing">true if managed resources should be disposed; otherwise, false. </param>

protected override void Dispose (bool disposing)

{

if (disposing && (components! = null))

{

components. Dispose ();

}

base. Dispose (disposing);

}

#region Windows Form Designer generated code

// / <summary>

// / Required method for Designer support - do not modify

// / the contents of this method with the code editor.

// / </summary>

private void InitializeComponent ()

{

this. userLabel = new System. Windows. Forms. Label ();

this. userTypeLabel = new System. Windows. Forms. Label ();

this. userTypeComboBox = new System. Windows. Forms.comboBox ();

this. userRightsLabel = new System. Windows. Forms. Label ();

this. userRightsComboBox = new System. Windows. Forms.comboBox ();

this. userPasswordLabel = new System. Windows. Forms. Label ();

this. userPasswordTextBox = new System. Windows. Forms. TextBox ();

this. userButton = new System. Windows. Forms. Button ();

this. userNameLabel = new System. Windows. Forms. Label ();

this. userNameTextBox = new System. Windows. Forms. TextBox ();

this. SuspendLayout ();

//

// userLabel

//

this. userLabel. Font = new System. Drawing. Font ("Microsoft Sans Serif", 14F, System. Drawing. FontStyle. Underline, System. Drawing. GraphicsUnit. Point, ( (byte) (204)));

this. userLabel. Location = new System. Drawing. Point (60,9);

this. userLabel. Name = "userLabel";

this. userLabel. Size = new System. Drawing. Size (154, 24);

this. userLabel. TabIndex = 0;

this. userLabel. Text = "Пользователь";

//

// userTypeLabel

//

this. userTypeLabel. Font = new System. Drawing. Font ("Microsoft Sans Serif", 10F, System. Drawing. FontStyle. Regular, System. Drawing. GraphicsUnit. Point, ( (byte) (204)));

this. userTypeLabel. Location = new System. Drawing. Point (12, 69);

this. userTypeLabel. Name = "userTypeLabel";

this. userTypeLabel. Size = new System. Drawing. Size (137, 23);

this. userTypeLabel. TabIndex = 3;

this. userTypeLabel. Text = "Тип пользователя: ";

this. userTypeLabel. TextAlign = System. Drawing. ContentAlignment. MiddleLeft;

//

// userTypeComboBox

//

this. userTypeComboBox. FormattingEnabled = true;

this. userTypeComboBox. Items. AddRange (new object [] {

"Гость",

"Пользователь",

"Администратор"});

this. userTypeComboBox. Location = new System. Drawing. Point (155, 71);

this. userTypeComboBox. Name = "userTypeComboBox";

this. userTypeComboBox. Size = new System. Drawing. Size (121, 21);

this. userTypeComboBox. TabIndex = 2;

this. userTypeComboBox. SelectedIndexChanged += new System. EventHandler (this. userType_SelectedIndexChanged);

this. userTypeComboBox. TextUpdate += new System. EventHandler (this. userType_TextUpdate);

this. userTypeComboBox. KeyPress += new System. Windows. Forms. KeyPressEventHandler (this. onKeyPress_ComboBox);

//

// userRightsLabel

//

this. userRightsLabel. Font = new System. Drawing. Font ("Microsoft Sans Serif", 10F, System. Drawing. FontStyle. Regular, System. Drawing. GraphicsUnit. Point, ( (byte) (204)));

this. userRightsLabel. Location = new System. Drawing. Point (12, 95);

this. userRightsLabel. Name = "userRightsLabel";

this. userRightsLabel. Size = new System. Drawing. Size (137, 23);

this. userRightsLabel. TabIndex = 5;

this. userRightsLabel. Text = "Права доступа: ";

this. userRightsLabel. TextAlign = System. Drawing. ContentAlignment. MiddleLeft;

//

// userRightsComboBox

//

this. userRightsComboBox. FormattingEnabled = true;

this. userRightsComboBox. Items. AddRange (new object [] {

"Чтение",

"Чтение/Запись",

"Чтение/Запись/Редактирование"});

this. userRightsComboBox. Location = new System. Drawing. Point (155, 97);

this. userRightsComboBox. Name = "userRightsComboBox";

this. userRightsComboBox. Size = new System. Drawing. Size (121, 21);

this. userRightsComboBox. TabIndex = 3;

this. userRightsComboBox. SelectedIndexChanged += new System. EventHandler (this. userRights_TextUpdate);

this. userRightsComboBox. TextUpdate += new System. EventHandler (this. userRights_TextUpdate);

this. userRightsComboBox. KeyPress += new System. Windows. Forms. KeyPressEventHandler (this. onKeyPress_ComboBox);

//

// userPasswordLabel

//

this. userPasswordLabel. Font = new System. Drawing. Font ("Microsoft Sans Serif", 10F, System. Drawing. FontStyle. Regular, System. Drawing. GraphicsUnit. Point, ( (byte) (204)));

this. userPasswordLabel. Location = new System. Drawing. Point (12, 121);

this. userPasswordLabel. Name = "userPasswordLabel";

this. userPasswordLabel. Size = new System. Drawing. Size (137, 23);

this. userPasswordLabel. TabIndex = 8;

this. userPasswordLabel. Text = "Пароль: ";

this. userPasswordLabel. TextAlign = System. Drawing. ContentAlignment. MiddleLeft;

this. userPasswordLabel. Visible = false;

//

// userPasswordTextBox

//

this. userPasswordTextBox. Location = new System. Drawing. Point (155, 124);

this. userPasswordTextBox. Name = "userPasswordTextBox";

this. userPasswordTextBox. Size = new System. Drawing. Size (121, 20);

this. userPasswordTextBox. TabIndex = 4;

this. userPasswordTextBox. Visible = false;

this. userPasswordTextBox. KeyPress += new System. Windows. Forms. KeyPressEventHandler (this. onKeyPress_passwordField);

//

// userButton

//

this. userButton. Location = new System. Drawing. Point (155, 159);

this. userButton. Name = "userButton";

this. userButton. Size = new System. Drawing. Size (121, 23);

this. userButton. TabIndex = 5;

this. userButton. Text = "Создать";

this. userButton. UseVisualStyleBackColor = true;

this. userButton. Visible = false;

this. userButton. Click += new System. EventHandler (this. onCreateButton_Click);

//

// userNameLabel

//

this. userNameLabel. Font = new System. Drawing. Font ("Microsoft Sans Serif", 10F, System. Drawing. FontStyle. Regular, System. Drawing. GraphicsUnit. Point, ( (byte) (204)));

this. userNameLabel. Location = new System. Drawing. Point (12, 43);

this. userNameLabel. Name = "userNameLabel";

this. userNameLabel. Size = new System. Drawing. Size (137, 23);

this. userNameLabel. TabIndex = 1;

this. userNameLabel. Text = "Имя пользователя: ";

this. userNameLabel. TextAlign = System. Drawing. ContentAlignment. MiddleLeft;

//

// userNameTextBox

//

this. userNameTextBox. Location = new System. Drawing. Point (155, 46);

this. userNameTextBox. Name = "userNameTextBox";

this. userNameTextBox. Size = new System. Drawing. Size (121, 20);

this. userNameTextBox. TabIndex = 1;

this. userNameTextBox. TextChanged += new System. EventHandler (this. userName_TextChanged);

//

// userForm

//

this. AutoScaleDimensions = new System. Drawing. SizeF (6F, 13F);

this. AutoScaleMode = System. Windows. Forms. AutoScaleMode. Font;

this. ClientSize = new System. Drawing. Size (295, 194);

this. Controls. Add (this. userNameTextBox);

this. Controls. Add (this. userNameLabel);

this. Controls. Add (this. userButton);

this. Controls. Add (this. userPasswordTextBox);

this. Controls. Add (this. userPasswordLabel);

this. Controls. Add (this. userRightsComboBox);

this. Controls. Add (this. userRightsLabel);

this. Controls. Add (this. userTypeComboBox);

this. Controls. Add (this. userTypeLabel);

this. Controls. Add (this. userLabel);

this. FormBorderStyle = System. Windows. Forms. FormBorderStyle. FixedDialog;

this. MaximizeBox = false;

this. MinimizeBox = false;

this. Name = "userForm";

this. Text = "Добавление пользователя";

this. ResumeLayout (false);

this. PerformLayout ();

}

#endregion

private System. Windows. Forms. Label userLabel;

private System. Windows. Forms. Label userTypeLabel;

private System. Windows. Forms.comboBox userTypeComboBox;

private System. Windows. Forms. Label userRightsLabel;

private System. Windows. Forms.comboBox userRightsComboBox;

private System. Windows. Forms. Label userPasswordLabel;

private System. Windows. Forms. TextBox userPasswordTextBox;

private System. Windows. Forms. Button userButton;

private System. Windows. Forms. Label userNameLabel;

private System. Windows. Forms. TextBox userNameTextBox;

}

}

Заключение

Объектно-ориентированное программимрование (ООП) - парадигма программирования, в которой основными концепциями являются понятия объектов и классов (либо, в менее известном варианте языков с прототипированием, - прототипов). Класс - это тип, описывающий устройство объектов. Понятие "класс" подразумевает некоторое поведение и способ представления. Понятие "объект" подразумевает нечто, что обладает определённым поведением и способом представления. Говорят, что объект - это экземпляр класса. Класс можно сравнить с чертежом, согласно которому создаются объекты. Обычно классы разрабатывают таким образом, чтобы их объекты соответствовали объектам предметной области.

Класс является описываемой на языке терминологии (пространства имён) исходного кода моделью ещё не существующей сущности, т. н. объекта. Объект - сущность в адресном пространстве вычислительной системы, появляющаяся при создании экземпляра класса (например, после запуска результатов компиляции (и линковки) исходного кода на выполнение).

Список использованной литературы

1. А.Н. Козин "Структуры и алгоритмы обработки данных" учебно-методическое пособие, 2010.

2. Эндрю Троелсон "С# и платформа.net", 2009.

Размещено на Allbest.ru


Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.