Hi, I'm trying to use both composition and inheritance as part of a learning project. I have a class Vehicle which uses composition to create objects of type date and insurance as part of its type. This works up to here, but when i try to create an object of type Car which inherits from vehicle I get a double free or corruption (fasttop) error. Any direction would be appreciated.
My constructor for vehicle is as follows, works fine up to here.
Code:
Vehicle::Vehicle(const char *model, const char *brand, const char *color, const char *usageStatus,
int year, int totalPass, int plateNum, float dayRate, const Insurance &ins,
const Date &sDate):lastServiceDate(sDate), insurance(ins)
My issue is using inheritance, my constructor is as follows:
Code:
Car::Car(const char * model, const char * brand, const char * color, const char *usageStatus,
int year, int totalPass, int plateNum, float dayRate, const Insurance &ins, const Date &sDate,bool sports,bool convertible):Vehicle(model, brand, color ,usageStatus, year, totalPass, plateNum, dayRate, ins, sDate){
setIsSports(sports);
setIsConvertible(convertible);
}
Appreciate any guidance given.
Thanks