This repository has been archived on 2022-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
patterns/iterator/simpleiterator/menuitem.d

45 lines
767 B
D

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);
}
}