I've made the automobile registry class with their atributes and functions but I have a few questions...Why can't class a have class b and vice versa?If we were to make another class for the owner's birthday couldn't we include it on the owner's class since there's an association with both?
Also,I'm a bit confused,if the automobile registry manages both vehicles and cars(inserts,erases,updates,etc.) is there a need for a constructor on both vehicles and owners,since there are already constructors on autoreg that receive the owners' and vehicles' properties?
And answering someone who has asked,yes,a owner can have multiple vehicles but a vehicle has one owner only,but could have had before multiple owners.
Any help is appreciated and thakns for the help!
Code:
class owner
{
private:
string name;
string address;
long id;
long phone;
public:
owner(string o_name,string o_address, long o_id,long o_phone);//constructor
void getname (void) const;
string setname(string o_name);
//etc,other gets and sets
}
class vehicle
{
private:
string model;
string brand;
string license;
long nr_oldowners;
public:
vehicle(string v_model,string v_brand,string v_license,long v_nr_oldowner)
void getlicense (void) const;
string setlicensestring o_name);
//etc,other gets and sets
}
class autoreg
{
private:
vehicle v;
owner o;
public:
insert_v(string v_model,string v_brand,string v_license,long v_nr_oldowner);//is this okay??
insert_o(string v_model,string v_brand,string v_license,long_nr_oldowner,string o_name,string o_address, long o_id,long o_phone););//is this okay??
erase_o(string o_name,string o_address, long o_id,long o_phone););//is this okay??
erase_v(string v_model,string v_brand,string v_license,long v_nr_oldowner););//is this okay??
update(string v_model,string v_brand,string v_license,long_nr_oldowner,string o_name,string o_address, long o_id,long o_phone););//is this okay??
}