#include <vcl.h>
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#pragma hdrstop

class Vehicle
{
 public:
   __property int Wheels = {read=GetWheels, write=SetWheels};

 private:
   int FWheels;  // liczba kół
   int GetWheels();
   void SetWheels(int num);
};
//---------------------------------------------------------
class Tir: public Vehicle
{
 public:
   __property int Cargo = {read=GetCargo, write=SetCargo};
 private:
   int FCargo; //ładowność
   int GetCargo();
   void SetCargo(int num);
};
//----------------------------------------------------------
enum type {Steyer, MAN, Volvo};
class Lorry: private Tir
{
 public:
   __property enum type LorryType = {read=GetLorryType,
                                     write=SetLorryType};
   void Show();
   enum type GetLorryType();
   void SetLorryType(enum type V);
  private:
   enum type FLorryType; // marka pojazdu
} L; //egzemplarz L klasy Lorry dziedziczącej po klasie Tir
//----------------------------------------------------------
int Vehicle::GetWheels()
{
  return FWheels;
};
//---------------------------------------------------------
void Vehicle::SetWheels(int num)
{
   FWheels=num;
   return;
}
//---------------------------------------------------------
int Tir::GetCargo()
{
   return FCargo;
};
//---------------------------------------------------------
void Tir::SetCargo(int num)
{
   FCargo=num;
   return;
}
//---------------------------------------------------------
enum type Lorry::GetLorryType()
{
  return FLorryType;
}
//----------------------------------------------------------
void Lorry::SetLorryType(enum type V)
{
  FLorryType=V;
}
//----------------------------------------------------------
void Lorry::Show()
{
  switch(GetLorryType()){
    case MAN:    {
         cout << " Ciezarowka marki MAN"<< endl;
         Wheels=6;
         cout << " Liczba kol: "<< Wheels << endl;
         Cargo = 20;
         cout << " Ladownosc: "<< Cargo << "ton"<< endl;
         break;
    }
    case Steyer: {
         cout << " Ciezarowka marki Steyer"<< endl;
         Wheels=10;
         cout << " Liczba kol: "<< Wheels << endl;
         Cargo = 40;
         cout << " Ladownosc: "<< Cargo << "ton"<< endl;
         break;
    }
    case Volvo: {
         cout << " Ciezarowka marki Volvo"<< endl;
         Wheels=8;
         cout << " Liczba kol: "<< Wheels << endl;
         Cargo = 35;
         cout << " Ladownosc: "<< Cargo << "ton"<< endl;
         break;
    }
  }
  return;
}
//---------------------------------------------------------
int main()
{
  clrscr();
  L.SetLorryType(Steyer);
  L.Show();
  getch();
  return 0;
}

