Salve a tutti sto creando un programma modulare ad oggetti che deve gestire un parcheggio deve essere formato da le seguenti tre classi formati da variabili membro, stringhe allocate dinamicamente, e con le seguenti caratteristiche :

-Veicolo classe Base (Nome e Marca)
-Motocicletta classe derivata da veicolo (Tipo)
-Automobile classe derivata da veicolo (Alimentazione)

In fine una classe Garage che deve contenere 20 oggetti, dalla posizione 0 a 19, di tipo o Motocicletta o Automobile, che devo essere creati nel main attraverso un sistema di scelte.

Il mio problema principale è la classe Garage, ho pensato di creare una classe Garage di tipo vettoriale ma mi sono bloccato perchè non so come creare un vettore che contenga o un oggetto motocicletta o un oggetto di tipo automobili consigli?

Questo è il mio codice:

Classe Vehiclelib.h:

codice:
#ifndef VEHICLE_H
#define VEHICLE_H
#define N 100


#include <iostream>
#include <cstring>


using namespace std;


namespace Garage{


    typedef char Buffer [N];


    class Vehicle{
         
        friend ostream & operator<<(ostream &,const Vehicle &);
        friend istream & operator>>(istream &, Vehicle &);    
        
        public:
            Vehicle(const char * = 0, const char * = 0);
            Vehicle(const Vehicle&);
            ~Vehicle();
            
            void set_Vehicle(const char *,const char *);
            void set_Name(const char *);
            void set_Brand(const char *);
            
            char *get_Name() const {return Name};
            char *get_Brand() const {return Brand};
            
            bool operator==(const Vehicle &);
            
        protected:
            virtual ostream &print(ostream &) const;
            virtual istream &read(istream &);
            
        private:
            char *Name;
            char *Brand;
         
    }; 


}


#endif

Vehiclefunct:

codice:
#include "Vehiclelib.h"

namespace Garage{


    Vehicle::Vehicle(const char *N, const char *B) { set_Vehicle(N, B); }
    
    Vehicle::Vehicle(const Vehicle &V) { set_Vehicle(V.Name, V.Brand); }
    
    void Vehicle::set_Vehicle(const char *N, const char *B){
        set_Name(N);
        set_Brand(B);
    }
    
    void Vehicle::set_Name(const char *N){
        Name= new char [strlen(N)+1];
        strcpy(Name, N);
    }
    
    void Vehicle::set_Brand(const char *B){
        Brand=new char [strlen(B)+1];
        strcpy(Brand, B);
    }
    
    Vehicle::~Vehicle(){
        delete [] Name;
        delete [] Brand;
    }
    
    ostream &Vehicle::print(ostream &out) const {
        out<<"Vehicle name :"<<Name<<" | Brand :"<<Brand;
        return out;
    }
    
    istream &Vehicle::read(istream &in){
        Buffer b1, b2;
        cout<<"\n Insert name of vehicle: ";
        cin.getline(B1, N-1, '\n');
        cout<<"\n Insert brand of vehicle: ";
        cin.getline(B2, N-1, '\n');
        set_Vehicle(B1, B2);
        return in;
    }
    
    ostream &operato<<(ostream &out, const Vehicle &V){
        V.print(out);
        return out;
    }
    
    istream &operator>>(istream &in, const Vehicle &V){
        V.read(in);
        return in;
    }
    
    bool Vehicle::operator==(const Vehicle &V){
        if(strcmp(Name, V.Name)==0&&strcmp(Brand, V.Brand)==0){
            return true;
        }else return false;
    }
    
}

Classe Motorbikelib.h

codice:
#ifndef MOTORBIKELIB_H
#define MOTORBIKELIB_H


#include "Vehiclelib.h"


using namespace Garage{


    class Motorbike: public virtual Vehicle{
        
        friend ostream &operator<<(ostream &, const Motorbike &);
        friend istream &operator>>(istream &, const Motorbike &);
        
        public:
            Motorbike(const char * = 0, const char * = 0, const char *=0);
            Motorbike(const Bike &);
            ~Motorbike();
            
            void set_Motorbiketype(const char *);
            char *get_Motorbiketype() {return Biketype};
            
            bool operator==(const Motorvike &);
        
        protected:
            virtual ostream &print(ostream &)const;
            virtual istream &read(istream &);
        
        private:
            char *Motorbiketype;
            
    };
}
#endif
Motorbikefunct:

codice:
#include "Motorbikelib.h"

using namespace Garage{


    Motorbike::Motorbike(const char *N, const char *B, const char *MBT):Vehicle(N, B) { set_Motorbiketype(MBT); }


    Motorbike::Motorbike(const Motorbike& MB):Vehicle(MB) { set_Motorbiketype(MB.Motorbiketype); }
    
    void Motorbike::set_Motorbiketype(const char *MBT){
        Motorbiketype= new char [strlen(MBT)+1];
        strcmp(Motorbiketype, MBT);
    }
    
    ~Motorobike::Motorbike() {delete [] Motorbiketype; };
    
    ostream &Motorbike::print(ostream &out)const {
    Vehicle::print(out);
    out<<"|Type : "<<Motorbiketype;
    return out;
    }
    
    istream &Motorbike::read(istream &in){
        Buffer b;
        Vehicle::read(in);
        cout<<"\n Insert the type of Motorbike :";
        cin.getline(b, N-1, '\n');
        set_Motorbiketype(b);
        return in;
        
    }
    
    ostream &operator<<(ostream &out, const Motorbike & MB){
        MB.print(out);
        return out;
    }
    
    istream &operator>>(istream &in, const Motorbike & MB){
        MB.read(in);
        return in;
    }
    
    bool Motorbike::operator==(Motorbike &MB){
        if(Motorbike::operator==(MB)&&strcmp(Motorbiketype, MB.Motorbiketype)==0);{
        return true;
        }else return false;
    }
    
}

Classe Carlib.h:

codice:
#ifndef CARLIB_H
#define CARLIB_H


#include "Vehiclelib.h"


using namespace Garage{


    class Car: public virtual Vehicle{
        
        friend ostream &operator<<(ostream &, const Car&);
        friend istream &operator>>(istream &, const Car&);
        
        public:
            Car(const char * =0, const char * =0, const char *=0)
            Car(const Car&);
            ~Car();
            
            void set_Fueltype(const char *);
            char *get_Fueltype() { return Fueltype};
            
            bool operator==(const Car&);
        
        protected:
            virtual ostream &print(ostream &out);
            virtual istream &read(istream &in);
            
        private:
            char *Fueltype; 
            
    };


}


#endif

Carfunct:

codice:
#include "Carlib.h"

using namespace Garage{


    Car::Car(const char *N, const char *B, const char *F):Vehicle(N, B){ set_Fueltype(F); }
    
    Car::Car(const Car &C):Vehicle(C){ set_Car(C.Fueltype); }
    
    void Car::set_Fueltype(const char *F){
        Fueltype= new char [strlen(F)+1];
        strcpy(Fueltype, F);
    }
    
    ~Car::Car(){delete [] Fueltype;}
    
    ostream &Car::print(ostream &out){
        Vehicle::print(out);
        out<<"| Fuel type: "<<Fueltype;
        return out;
    }
    
    isteram &Car::read(ostream &in){
        Buffer b;
        Vehicle::read(in);
        cin.getline(b, N-1, '\n');
        set_Fueltype(b);
        return in;
    }
    
    ostream &operator<<(ostream &out, const Car & C){
        C.print(out);
        return out;
    }
    
    istream &operator<<(istream &in, const Car &C){
        C.read(in);
        return in;
    }
    
    bool Car::operator==(const Car &C){
        
        if(Vehicle::operator==(C)&&strcmp(Fueltype, C.Fueltype)==0){
            return true;
        }else return false;
    }
    
}

Classe Garagelib.h:

codice:
#ifndef GARAGELIB_H
#define GARAGELIB_H


#include "Morbikelib.h"
#include "Carlib.h"


namespace Garage{
    
    class Garage:public Car, public Motorbike{
        


    };
    
}


#endif
E qui mi sono bloccato consigli? E' uno dei miei primi programmi modulare ci sono molti errori?