tags:

views:

84

answers:

1

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_PINTO_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.

A: 

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).

sharptooth
IDL is not merely for defining interfaces; for example, you can define enumerations, you can define constants, you can define structs. Given that you can define constants and that you can define structs, I don't see why it's out of the question that you might be able to define constant instances of structs, and this ability would satisfy my requirements.
Ptah- Opener of the Mouth
Yeap, you can define structs and interfaces - those are contracts specifying how instances behave, but you can't define instances themselves.
sharptooth
Yes, you can define instances. For example, you can define an instance of a long.
Ptah- Opener of the Mouth