什么是不透明值? [英] What is an opaque value?
本文介绍了什么是不透明值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
C ++中的不透明值是什么?
What is an "opaque value" in C++?
推荐答案
不透明指针的示例为不透明指针 code> FILE (来自C库):
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;
}
您从fopen()获取一个FILE指针,并将其用作参数对于其他功能,但你永远不会对它实际指向 的东西打扰。
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.
这篇关于什么是不透明值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文