get_ and Get ?
|Top Previous Next|
What is the difference between the functions like these:
// High syntax version Get...
ComponentOccurrencesPtr pActOccs=ActDef->GetOccurrences() ; // I suggest you avoid using this version
// Raw syntax version get_...
pAssemblyCompDef->get_Occurrences(&pOccs); // I suggest you use this version
GetProperty and MethodMethName(): is called “high” method syntax
get_property and MethodName(): is the “raw” syntax.
The first one returns a value and can throw exceptions. The second one returns an error code and take the return value as in/out param. This is usually the suggested way to use the API, reason is that your program is less likely to crash in case you are not handling exceptions.
The returned property value itself is of course identical using one or the other syntax.
Using the second method also means that you generally do not have to worry about Releasing smart pointers and other COM arcania...
See also VARIANT and CComVariant.
Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)