-
Notifications
You must be signed in to change notification settings - Fork 0
/
element.h
36 lines (26 loc) · 956 Bytes
/
element.h
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
/*
* File: element.h
* Author: swistak
*
* Created on 28 czerwiec 2010, 15:58
*/
#ifndef _ELEMENT_H
#define _ELEMENT_H
#include "common.h"
///Element z plecaka. Mozna bylo to lepiej zrobic bez seterow. ale nie moglem wtedy alokowac tablicy w klasie KnapsackProblem
///To mozna poprawic ale trzeba sie douczyc. Jak alokowac pamiec dla elementow bez domyslnego konstruktora przy uzyciu operatora new.
///Klasa zawiera dwa pola i reperezentuje element ktory mozna zabrac. Posiada informacje o jego wadze oraz cenie calkowitej.
class Element{
private:
double weight; ///<masa elementu
double price; ///<cena elementu
void setWeight(double A_weight); ///<funkcja ustawiajaca wage elementu
void setPrice(double A_price); ///<funkcja ustawiajaca cene elementu
public:
Element(double A_weight=0., double A_price=0.);
double getWeight();
double getPrice();
std::string toString();
friend class KnapsackProblem;
};
#endif /* _ELEMENT_H */