Czoko_Smieciarka/Trunk/Components/CzokoŚmieciarka.DataModels/Interfaces/Garbage/AGarbage.cs
2019-03-13 17:23:52 +01:00

49 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CzokoŚmieciarka.DataModels.Interfaces
{
public abstract class AGarbage : IGarbage
{
protected AGarbage(ITypeOfGarbage typeOfGarbage, int weight)
{
this.TypeOfGarbage = typeOfGarbage;
this.Weight = weight;
}
public ITypeOfGarbage TypeOfGarbage { get; }
public virtual int Weight { get; set; }
public virtual int Volume
{
get { return this.Weight / TypeOfGarbage.Density; }
}
protected abstract AGarbage Add(AGarbage garbageToAdd);
protected abstract AGarbage Subtract (AGarbage garbageToSubtract);
#region Operators
public static AGarbage operator + (AGarbage a, AGarbage b)
{
return a.Add(b);
}
public static AGarbage operator - (AGarbage a, AGarbage b)
{
return a.Subtract(b);
}
#endregion
public object Clone()
{
return this.MemberwiseClone();
}
}
}