You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.4 KiB
57 lines
1.4 KiB
|
|
using System;
|
|
|
|
namespace Model
|
|
{
|
|
/// <summary>
|
|
/// Define the base structure of any Items.<br/>
|
|
/// An Item can be identifed and have a short description. It can also be displayed.
|
|
/// </summary>
|
|
public abstract class BaseItem : IDisplayable
|
|
{
|
|
/// <summary>
|
|
/// The identifier of an Item.<br/>
|
|
/// The first number correspond to the typs of the Item.
|
|
/// </summary>
|
|
public uint Id { get; }
|
|
|
|
/// <summary>
|
|
/// A short description of the Item. Useful to know what this Item stand for.
|
|
/// </summary>
|
|
public string Description { get; set; }
|
|
|
|
|
|
protected BaseItem(uint id, string description = "")
|
|
{
|
|
Id = id;
|
|
Description = description;
|
|
}
|
|
|
|
|
|
public override string ToString()
|
|
{
|
|
return
|
|
$"[ Class -BaseItem- ]\n\n" +
|
|
$"\t.Id - {Id}\n" +
|
|
$"\t.Description - {Description}\n" +
|
|
$"______\n\n";
|
|
}
|
|
|
|
// IDisplayable Implementation
|
|
public void DisplayId()
|
|
{
|
|
Console.WriteLine($".Id - {Id}");
|
|
}
|
|
|
|
public void DisplayDescription()
|
|
{
|
|
Console.WriteLine($".Description - {Description}");
|
|
}
|
|
|
|
public void DisplayItem()
|
|
{
|
|
Console.WriteLine(this.ToString());
|
|
}
|
|
}
|
|
}
|