Re: error MIDL2025 : syntax error : expecting { near ","
Donos <donguy76@gmail.com> wrote:
What's CHonda and CToyota? Did you mean IHonda and IToyota? If so,
then yes, you should derive from both IHonda and IToyota but not from
ICar or IVehicle.
Actually the organization of code is a little different. I am just
using one CoClass for all Interfaces and then a COM MAP Entry inside
the header of that CoClass for all interfaces. And that is the
CVehicleCoClass.
What i did is,
class CHonda : public IHonda
{
};
..................................................
Like that, classes for all Interfaces.
You are trying to insert intermediate classes into an existing
inheritance hierarchy. That's not going to work. I strongly recommend
that you reconsider your design. Break the set of methods into
interfaces in a way that the interfaces can be implemented side by side,
rather than deriving one from another. You'll have nothing but trouble
if you continue with your current design.
So as per your suggestion i won't be deriving the CVehicleCoClass from
CVehicle and CCar as both are already inherited inside CHonda,
CToyota. Right?
Wrong. CHonda is derived from IHonda which is derived from ICar and
IVehicle. There is no CCar or CVehicle in this chain, and there's no way
to put them there.
I am pretty new to COM programming. I agree with you that this design
has its flaws.
That's probably the most charitable way to describe it.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925