English 中文(简体)
Struct inheritance in MIDL
原标题:

I am trying to inherit from and extend a structure defined in MIDL. I used the same syntax as for interface inheritance i.e

typedef struct stDBIBinVarDataEx
 {
   float x;
 } MYSTRUCT ;

struct struct2 : MYSTRUCT
 {
   float y;
 };

but the compiler generates errors.

最佳回答

You can t. MIDL isn t a C++ compiler.

You CAN declare struct2 as containing MYSTRUCT:

struct struct2
{
    MYSTRUCT mystruct;
    float y;
}

It s not quite the same thing but it s probably as close as you re going to get.

问题回答

暂无回答




相关问题
Subclass check, is operator or enum check

A couple of friends was discussing the use of inheritance and how to check if a subclass is of a specific type and we decided to post it here on Stack. The debate was about if you should implement a ...

C++ Class Inheritance problem

Hi I have two classes, one called Instruction, one called LDI which inherits from instruction class. class Instruction{ protected: string name; int value; public: Instruction(string ...

Overloading a method in a subclass in C++

Suppose I have some code like this: class Base { public: virtual int Foo(int) = 0; }; class Derived : public Base { public: int Foo(int); virtual double Foo(double) = 0; }; ...

Embedding instead of inheritance in Go

What is your opinion of this design decision? What advantages does it have and what disadvantages? Links: Embedding description

Extending Flex FileReference class to contain another property

I want to extend the FileReference class of Flex to contain a custom property. I want to do this because AS3 doesn t let me pass arguments to functions through event listeners, which makes me feel sad,...

Interface Inheritance in C++

I have the following class structure: class InterfaceA { virtual void methodA =0; } class ClassA : public InterfaceA { void methodA(); } class InterfaceB : public InterfaceA { virtual ...

热门标签