29 lines
507 B
C++
29 lines
507 B
C++
#include "codeslot.h"
|
|
#include <stdexcept>
|
|
#include <iostream>
|
|
|
|
CodeSlot::CodeSlot(int code): vergrendeld(true), code(code){
|
|
}
|
|
|
|
bool CodeSlot::isVergrendeld(){
|
|
return vergrendeld;
|
|
}
|
|
|
|
void CodeSlot::ontgrendel(string code){
|
|
try{
|
|
if (stoi(code) == this->code){
|
|
vergrendeld = false;
|
|
}
|
|
else{
|
|
vergrendeld = true;
|
|
}
|
|
}
|
|
catch(const std::invalid_argument &error){
|
|
return;
|
|
}
|
|
}
|
|
|
|
void CodeSlot::vergrendel(){
|
|
vergrendeld = true;
|
|
}
|