What is an "opaque value" in C++?
That's similar to opaque pointer - a value that doesn't store data your code could interpret or provide access to data, but only identifies some other data. A typical example is a Win32 handle like HBITMAP
bitmap handle - you can only pass it to relevant functions, but you can't do anything to the underlying bitmap directly.
I assume (since your question did not give enough context to be sure) that you are referring to something like Opaque Pointers.
An example for an Opaque Pointer is FILE
(from the C library):
#include <stdio.h>
int main()
{
FILE * fh = fopen( "foo", "r" );
if ( fh != NULL )
{
fprintf( fh, "Hello" );
fclose( fh );
}
return 0;
}
You get a FILE pointer from fopen(), and use it as a parameter for other functions, but you never bother with what it actually points to.
FILE* is a good example of an opaque value. You don't use it directly; it's a single "blob" which you can't interpret or manipulate. Instead, you use a set of functions (fopen, fwrite, fprintf, etc.) which know how to manipulate it.
Being opaque in this way is common to many situations (and in many APIs) where you have a "magical" handle: a black box.