Hello,
I develop add-ons for MS Flight Simulator and I use the poorly documented SDK for this. The SDK provides a .h file in which an interface class is defined (with pure virtual methods only), something like this:
In my code, I use this interface like this:Code:class IPanelCCallback { public: virtual IPanelCCallback* QueryInterface (PCSTRINGZ pszInterface) = 0; virtual bool ConvertStringToProperty (PCSTRINGZ keyword, SINT32* pID) = 0; virtual bool ConvertPropertyToString (SINT32 id, PPCSTRINGZ pKeyword) = 0; };
Everything works fine, but I don't understand why... I thought the linker would stop with an "undefined symbol" error because the IPanelCCallback methods, such as ConvertStringToProperty, are declared as pure virtual but defined nowhere, and I don't use any library for linking. With such an interface class, I thought I would have to defined a subclass of IPanelCCallback and define the ConvertStringToProperty method. My code works, so I shouldn't complain, but I would like to know more about the use of interface classes, this is a subject I don't know much.Code:IPanelCCallback* pCallBack = panel_get_registered_c_callback("fs9gps"); ... SINT32 id; pCallBack->ConvertStringToProperty(propertyName, &id);
Any information is greatly welcome !!
Thank you,
Eric


Reply With Quote

Bookmarks