Добавил:
выбрасываю тут свой мусор, надеюсь, что он кому-то может пригодится... Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
laba3.docx
Скачиваний:
6
Добавлен:
03.12.2023
Размер:
328.61 Кб
Скачать

Contact.Cs

namespace Shtan

{

public class Contact

{

private string beginDt;

private string endDt;

private string dateInto;

private string descr;

private ContType cntType;

public Contact(ContType type)

{

cntType = type;

}

public string BeginDT

{

get

{

return beginDt;

}

set

{

beginDt = value;

}

}

public string EndDt

{

get

{

return endDt;

}

set

{

endDt = value;

}

}

public string DateInto

{

get

{

return dateInto;

}

set

{

dateInto = value;

}

}

public string Descr

{

get

{

return descr;

}

set

{

descr = value;

}

}

public ContType ContType

{

get

{

return cntType;

}

set

{

cntType = value;

}

}

public Contact Clone()

{

ContType type = this.cntType;

Contact con = new Contact(type);

con.beginDt = beginDt;

con.dateInto = dateInto;

con.descr = descr;

con.endDt = endDt;

con.cntType = cntType;

return con;

}

public static bool operator ==(Contact lhs, Contact rhs)

{

if (lhs.beginDt == rhs.beginDt &&

lhs.cntType == rhs.cntType &&

lhs.dateInto == rhs.dateInto &&

lhs.descr == rhs.descr &&

lhs.endDt == rhs.endDt)

return true;

else return false;

}

public static bool operator !=(Contact lhs, Contact rhs)

{

return !(lhs == rhs);

}

}

}

ContType.Cs

namespace Shtan

{

public class ContType

{

private string name;

private string note;

public string Name

{

get

{

return name;

}

set

{

name = value;

}

}

public string Note

{

get

{

return note;

}

set

{

note = value;

}

}

}

}

ContTypeCol.Cs

namespace Shtan

{

public class ContTypeCol

{

private List<ContType> _lst;

public ContType this[int index]

{

get { return _lst[index]; }

set { _lst[index] = value; }

}

public void Add(ContType new_contact)

{

_lst.Add(new_contact);

}

public void Clear()

{

_lst.Clear();

}

public ContTypeCol()

{

_lst = new List<ContType>();

}

}

}

Соседние файлы в предмете Объектно-ориентированное программирование