### Using Static Functions in Interface Design

Your IDL interfaces must be designed to make it clear which functions are static, because it may not be intuitive to first-time users. If something is static it does not move or change; it retains its state. In C++ the term static has a little more meaning than this. C++ uses the term to restrict the definition of a variable or function to within a specific scope of a program, and it causes values to be retained when program executions comes back to that scope. Both static and global variables give a program a convenient way for one part to easily communicate with another without using parameters, but a static variable's scope is confined to a portion of the program rather than the scope of the entire program. A static class member is a data member or member function that is in the scope of all objects of a particular class, but not in the scope of any other class objects or code of the program. A class's objects use static members to share data and functionality in a way that saves storage. A static data member acts as a class-global variable because there is only one instance of it, no matter how many instances of the class exist.

Programs and interfaces can declare a member function as static. Unlike nonstatic class members, static class members can be accessed or invoked directly, even if an instance of the class does not exist. For this reason, it is useful to developers if the interface designed identifies all operations in the interface that are to be static member functions by doing all of the following:

· Identifying static operations with comments in the IDL file.

· Grouping static operations together in the IDL file.

· Specifying static operations in the interface by using the static keyword. This will self-document the static member functions. However, this imposes a restriction that requires that the interface be compiled for C++ only and that servers implement the member function as static. If you do not want to impose this in the interface definition, use the cxx_static attribute in an Attribute Configuration File (ACF) to specify a static member function.

###