PreviousNext

The static Keyword for Operations

In C++ applications, the interface definition operations specify the member functions of the interface class. The majority of the member functions are invoked by an existing object, but some operations are intended to work regardless of whether an object invokes them or not. Static member functions are invoked independently from any object and are good for such things as object creator functions and for obtaining a class's static data; that is, data that is class-wide and independent from a specific object.

Static member functions can be specified in an interface definition by using the static keyword in front of the operation, in one of the following ways:

static return_type operation_identifier(…);

[operation_attribute, …] static return_type operation_identifier(…);

Instead of using the static keyword in the interface definition, you can use the cxx_static attribute in an ACF.

Because nonstatic member functions are invoked by an object for which the application must already have a binding, nonstatic operations cannot have a binding handle parameter. If you want to use explicit binding for an interface, only static operations can have a binding handle as the first parameter.