-
Notifications
You must be signed in to change notification settings - Fork 0
/
Produkt.cs
60 lines (51 loc) · 1.42 KB
/
Produkt.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mip2011
{
//Superklassen. Toppen af hierakiet.
public abstract class Produkt
{
protected Producent producent;
public Producent Producent
{
get { return producent; }
set { producent = value; }
}
protected string produktNavn;
public string ProduktNavn
{
get { return produktNavn; }
set { produktNavn = value; }
}
protected decimal pris;
public decimal Pris
{
get { return pris; }
set {
if (pris < 0)
throw new ArgumentException(" Prisen må ikke være negatif");
else { pris = value; }
}
}
protected internal int produktKode;
public int ProduktKode
{
get { return produktKode; }
set { produktKode = value; }
}
//Tidligt forgæves forsøg på at trække kapacitet op i produkt,
//for at override det i Lagringsenhed.
//private int kapacitet = null;
//public int Kapacitet
//{
// get { return kapacitet; }
// set { kapacitet = value;}
//}
public override string ToString()
{
return "\n Produkt navn: " + ProduktNavn+ "\nPris: " + Pris;
}
}
}