IDL in ATL/COM: Can I publish a const of a complex type?
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
).
精彩评论