I have an ATL/COM-based DLL, written in VC++ 6.0. Until recently, there was a one-to-one correspondence between my COM interfaces and classes. For example, let's say there was a ICar interface; then there was also a CCar class which implemented it, and no class other than CCar implemented ICar, and CCar implemented no interface (of mine) other than ICar. Similarly, IPlane and CPlane. The definitions might be something like:
ICar had functions "StepOnGas" and "MaxPassengers"; IPlane had functions "LowerLandingGear" and "MaxPassengers".
Recently, I changed it so that there's an IVehicle interface, which has no corresponding CVehicle class, and which both CCar and CPlane implement. So:
ICar has "StepOnGas"; IPlane has "LowerLandingGear"; IVehicle has "MaxPassengers". CCar implements ICar and IVehicle; CPlane implements IPlane and IVehicle.
This is working fine, but it's a bit of a pain from the DLL client's perspective; they've got an ICar, and they want to know how many passengers it can hold. Previously, they could just ask it; now, they have to jump through the hoop of changing it into an IVehicle before they can ask it.
So what I'd like to do is more along the lines of this:
ICar has "StepOnGas" and "MaxPassengers"; IPlane has "LowerLandingGear" and "MaxPassengers"; IVehicle has "MaxPassengers". CCar still implements both ICar and IVehicle, and CPlane still implements both IPlane and IVehicle.
I want there to be one and only one "MaxPassengers" for CCar, and it to be accessible both from ICar and from IVehicle; similarly, one and only one "MaxPassengers" for CPlane, and it accessible both from IPlane and IVehicle.
Would this cause any problems? Would I have to do anything specific other than just add "MaxPassengers" to the IDL for ICar and IPlane?
In case it matters, clients of this DLL are written in both VC++ 6.0 and VB6.
Thanks in advance for any help.