elektromotor.cpp 760 B
#include "elektromotor.h"
#include <iostream>
Elektromotor::Elektromotor() :geschwindigkeit(0), position(0) {}
//Elektromotor::~Elektromotor() {}
void Elektromotor::antreiben() {
std::cout << "Motor treibt mit Geschwindigkeit " << geschwindigkeit << " an." << std::endl;
}
void Elektromotor::stop() {
geschwindigkeit = 0;
std::cout << "Motor gestoppt." << std::endl;
}
void Elektromotor::bewegezurPosition(int neu) {
position = neu;
std::cout << "Motor bewegt sich zur Position " << position << std::endl;
}
int Elektromotor::getPosition() const {
return position;
}
void Elektromotor::setGeschwindigkeit(int geschw) {
geschwindigkeit = geschw;
}
int Elektromotor::getGeschwindigkeit() const {
return geschwindigkeit;
}