27 lines
665 B
C++
27 lines
665 B
C++
/// @file
|
|
/// @brief task B: Car class
|
|
|
|
#pragma once
|
|
|
|
#include "taskB.Device.hpp" // Device
|
|
|
|
/// @todo Implement a class `Car` that publicly derives from 'Device'
|
|
|
|
class Car : public Device {
|
|
private:
|
|
std::string name_;
|
|
std::string model_;
|
|
double price_;
|
|
double power_;
|
|
|
|
public:
|
|
Car(std::string name, std::string model, double price, double power)
|
|
: name_(name), model_(model), price_(price), power_(power) {}
|
|
|
|
void print_info() const final override {
|
|
std::cout << name_ << ": " << model_ << std::endl;
|
|
std::cout << " power: " << power_ << " Kilowatts" << std::endl;
|
|
std::cout << " price: " << price_ << " EUR" << std::endl;
|
|
}
|
|
};
|