开发者

IDL in ATL/COM: Can I publish a const of a complex type?

开发者 https://www.devze.com 2022-12-16 23:39 出处:网络
I know how to publish a const of a simple type in IDL, for example: const long blah = 37 But I want to publish consts of complex types, with methods, or at least readable struct-like member fields.

I know how to publish a const of a simple type in IDL, for example:

const long blah = 37

But I want to publish consts of complex types, with methods, or at least readable struct-like member fields. For example, perhaps a type called CarType, which has accessor fields like "get_Make", "get_Model", "get_Year", "get_BasePrice", et cetera.

Then I would like to publish const instances, such as FORD_PI开发者_运维技巧NTO_1973.

(Please don't read too much into the example, to tell me that this particular example would lend itself better to just regular classes without const instances or something like that).

I have no idea how I would define, in IDL, the fact that FORD_PINTO_1973 has a Year field of 1973.

Thanks in advance for any help.


IDL is for defining interfaces - contracts of what can be done on an object. Real objects implementation is out of IDL.

In order to provide a read-only property provide a getter (use propget attribute) and don't provide the setter (propput).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号