Add Sortiment
This commit is contained in:
parent
ace7da5f91
commit
7c4662b322
|
|
@ -4,7 +4,7 @@ BINARY = prototyp
|
|||
# Name of the binary for Release
|
||||
FINAL = prototyp
|
||||
# Object files
|
||||
OBJS = main.o Machine.o MachineProductA.o MachineProductB.o Factory.o ##Product.o
|
||||
OBJS = Sortiment.o
|
||||
# Compiler flags
|
||||
CFLAGS = -Werror -Wall -std=c++17 -fsanitize=address,undefined -g
|
||||
# Linker flags
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
#include "Sortiment.h"
|
||||
|
||||
void Sortiment::addWare(Ware *ware) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (this->waren[i] == nullptr) {
|
||||
this->waren[i] = ware;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#pragma once
|
||||
|
||||
class Ware;
|
||||
|
||||
class Sortiment {
|
||||
private:
|
||||
Ware *waren[10];
|
||||
|
||||
public:
|
||||
void addWare(Ware *ware);
|
||||
Sortiment() {
|
||||
for (int i = 0; i < 10;) {
|
||||
waren[i] = nullptr;
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
Reference in New Issue