module;
#include <iostream>
#include <string>
#include <string_view>
#include <print>

export module Vehicle;

// Basisklasse fuer alle Fahrzeuge
export class Vehicle
{
    std::string manufacturer;        // Hersteller
    std::string model;               // Typ
protected:  // Verhindert Definition von Fahrzeug-Objekten
    // ctor
    Vehicle(std::string_view man, std::string_view mod) :
        manufacturer(man), model(mod)
    { }
public:
    // dtor
    virtual ~Vehicle()
    { }
    // Ausgabe der Daten
    virtual void Print() const
    {
        std::print("{} {}, ", manufacturer, model);
    }
};

// Klasse fuer Fahrzeuge mit Verbrennungsmotor
export class Petrol: public Vehicle
{
    unsigned short tank;        // Tankinhalt
public:
    // ctor
    Petrol(std::string_view man, std::string_view mod, unsigned short ta):
        Vehicle(man, mod), tank(ta)
    { }
    // Ausgabe der Daten
    virtual void Print() const
    {
        Vehicle::Print();
        std::println("Tankinhalt: {} ltr", tank);
    }
};

// Klasse fuer Elektroauto
export class Electric: public Vehicle
{
    unsigned short batterie;     // Batteriekapzitaet
public:
    // ctor
    Electric(std::string_view man, std::string_view mod, unsigned short bat):
        Vehicle(man, mod), batterie(bat)
    { }
    // Ausgabe der Daten
    virtual void Print() const
    {
        Vehicle::Print();
        std::println("Batteriekapazitaet: {} kWh", batterie);
    }
};
