patterns/iterator/simpleiterator/menuitem.d

45 lines
767 B
D
Raw Permalink Normal View History

2022-12-05 07:38:19 +00:00
module menuitem;
import std.conv : to;
class MenuItem
{
private string name;
private string description;
private bool vegetarian;
private double price;
this(string name, string description, bool vegetarian, double price)
{
this.name = name;
this.description = description;
this.vegetarian = vegetarian;
this.price = price;
}
string getName()
{
return name;
}
string getDescription()
{
return description;
}
double getPrice()
{
return price;
}
bool isVegetarian()
{
return vegetarian;
}
override string toString() const
{
return (name ~ ", $" ~ price.to!string ~ "\n " ~ description);
}
}