-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItem.cs
63 lines (55 loc) · 1.29 KB
/
Item.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShoppingListApp
{
public class Item
{
/* Item class:
* An item in the shopping list
* */
// Private data members
private int id;
private int categoryId;
private string name;
// Properties
public int Id
{
get { return id; }
set { id = value; }
}
public int CategoryId
{
get { return categoryId; }
set { categoryId = value; }
}
public string Name
{
get { return name; }
set { name = value; }
}
// Constructors
public Item()
{
// Default constructor: creates invalid Item
id = -1;
categoryId = -1;
name = null;
}
public Item(string itemName)
{
// Sets the name of the item
// TODO: set up auto id numbering
name = itemName;
}
public Item(int tempId, string itemName, int catId)
{
// For temp use
id = tempId;
name = itemName;
categoryId = catId;
}
}
}